Skip to content

Commit

Permalink
LaTeX: \catcode assignment should be terminated (#1711)
Browse files Browse the repository at this point in the history
This is almost irrelevant. But \catcode`\_=8 without termination might
let LaTeX expand prematurely its token stream. Of course here in the
context of fancyvrb.sty chances are 99.99% that what comes next does not
expand or expands safely. I did not look in code.

Only a matter of style, to be on the safe side.
  • Loading branch information
jfbu committed Feb 12, 2021
1 parent 35fc0e0 commit 68af590
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pygments/formatters/latex.py
Expand Up @@ -342,7 +342,8 @@ def format_unencoded(self, tokensource, outfile):
(start and ',firstnumber=%d' % start or '') +
(step and ',stepnumber=%d' % step or ''))
if self.mathescape or self.texcomments or self.escapeinside:
outfile.write(',codes={\\catcode`\\$=3\\catcode`\\^=7\\catcode`\\_=8}')
outfile.write(',codes={\\catcode`\\$=3\\catcode`\\^=7'
'\\catcode`\\_=8\\relax}')
if self.verboptions:
outfile.write(',' + self.verboptions)
outfile.write(']\n')
Expand Down

0 comments on commit 68af590

Please sign in to comment.