`LatexFormatter`'s `mathescape` does not escape backslashes inside `gnuplot` comment
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 885
- PR merge metrics
- No merged PRs in 30d
Description
LatexFormatter's mathescape does not escape backslashes inside gnuplot comment. This causes an unexpected error when compiling with LaTeX.
For example, let's consider the following gnuplot code:
# $\alpha$
pygmentize this with the following command:
python -m pygments -f latex -l gnuplot -O mathescape test.gnuplot
Expected result is:
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PY{c}{\PYZsh{} $\alpha$}
\end{Verbatim}
However, actual result is:
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PY{c}{\PYZsh{}}\PY{c}{ $}\PY{c}{\PYZbs{}}\PY{c}{alpha$}
\end{Verbatim}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the LatexFormatter entry point and reproduce the issue using the shown pygmentize command with the gnuplot input. Trace how mathescape handles the comment, then verify that the generated output matches the expected LaTeX and compiles without an unexpected error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex, python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100