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

LaTeX: \catcode assignment should be terminated #1711

Merged

Conversation

jfbu
Copy link
Contributor

@jfbu jfbu commented Feb 12, 2021

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.

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.
@jfbu
Copy link
Contributor Author

jfbu commented Feb 12, 2021

here in the
context of fancyvrb.sty

I mean that most people use the LaTeXFormatter output with fancyvrb latex package, because the syntax used in clearly targeted at that package.

Actually on looking at its doc now I see it gives an example from which the Pygments is probably inspired, and there is no \relax there. However, at Sphinx we will probably drop fancyvrb in future (cf discussion at sphinx-doc/sphinx#8686) to solve some issues with page breaks (already we have to work hard to get wrapping of code lines). So in future the codes={...} option might end in some other context than fancyvrb code. It would then be better to use the safer syntax I indicated, although, as I said, this is almost of nil relevance.

@birkenfeld birkenfeld merged commit 68af590 into pygments:master Feb 12, 2021
@birkenfeld
Copy link
Member

Thanks!

@Anteru Anteru added this to the 2.8 milestone Feb 12, 2021
@jfbu jfbu deleted the LaTeX_add_a_termination_to_catcode_assign branch February 12, 2021 22:15
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

Successfully merging this pull request may close these issues.

None yet

3 participants