Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Underscores in LaTeX autorefs Are Unnecessarily Escaped #250

Closed
ipetraka opened this issue Jun 17, 2023 · 1 comment
Closed

Underscores in LaTeX autorefs Are Unnecessarily Escaped #250

ipetraka opened this issue Jun 17, 2023 · 1 comment

Comments

@ipetraka
Copy link

Version: MultiMarkdown 6.7.0
System: Linux Debian 11.7 "Bullseye"; macOS 13.x "Ventura"

Description

The handling of label names for LaTeX conversion will unnecessarily escape underscore characters (_), in the value inserted into \autoref{...}. This will cause LaTeX compilation to break as the \ character inserted by MMD is invalid in a label, and wouldn't match the value inserted into the \label{...} anyway (which is correctly output, and not escaped).

Reproduction

Execute the following test data into a shell:

$ multimarkdown -t latex
# Test Hyphenated-Words and Underscored_Words in Labels

And test references to them, [Test Hyphenated-Words and Underscored_Words in Labels], and [to images](#image_name).

![Figure caption][image_name]

[image_name]: /path/to/image_name.jpg

# Also test manual labels [manual_section]

And the references we would make to them, [][manual_section].

Expected Result (6.6.0 output)

\part{Test Hyphenated-Words and Underscored\_Words in Labels}
\label{testhyphenated-wordsandunderscored_wordsinlabels}

And test references to them, Test Hyphenated-Words and Underscored\_Words in Labels (\autoref{testhyphenated-wordsandunderscored_wordsinlabels}), and to images (\autoref{image_name}).

\begin{figure}[htbp]
\centering
\includegraphics[keepaspectratio,width=\textwidth,height=0.75\textheight]{/path/to/image_name.jpg}
\caption{Figure caption}
\label{image_name}
\end{figure}

\part{Also test manual labels}
\label{manual_section}

And the references we would make to them, \autoref{manual_section}.

Actual Result

As we can see, the labels themselves are all correctly listed, but all three different forms of referencing will escape the underscore character.

\part{Test Hyphenated-Words and Underscored\_Words in Labels}
\label{testhyphenated-wordsandunderscored_wordsinlabels}

And test references to them, Test Hyphenated-Words and Underscored\_Words in Labels (\autoref{testhyphenated-wordsandunderscored\_wordsinlabels}), and to images (\autoref{image\_name}).

\begin{figure}[htbp]
\centering
\includegraphics[keepaspectratio,width=\textwidth,height=0.75\textheight]{/path/to/image_name.jpg}
\caption{Figure caption}
\label{image_name}
\end{figure}

\part{Also test manual labels}
\label{manual_section}

And the references we would make to them, \autoref{manual\_section}.
@ipetraka ipetraka changed the title Underscores in LaTeX autorefs are Unnecessarily Escaped Underscores in LaTeX autorefs Are Unnecessarily Escaped Jun 17, 2023
@fletcher
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants