You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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}.
The text was updated successfully, but these errors were encountered:
ipetraka
changed the title
Underscores in LaTeX autorefs are Unnecessarily Escaped
Underscores in LaTeX autorefs Are Unnecessarily Escaped
Jun 17, 2023
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:
Expected Result (6.6.0 output)
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.
The text was updated successfully, but these errors were encountered: