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
goes some redefinition of latex macros from Pygments output. In the first case this is to keep baseline constant even in case of error tokens, in the second case to avoid a change to \fboxsep to propagate (I do not recall if this one is cosmetic only, but the first one is definitely needed).
But using for example pygments_style = 'autumn' in conf.py one sees that original pygments LaTeXFormatter output is
(I have edited it to avoid irrelevant \expandafter\def\csname... low-level stuff which is a slight bug of Pygments because unneeded; the @ character must have been allowed in latex macro names here, from the fact that the mark-up uses for example \PYG@it with so scruples, so all the \expandafter\def... from Pygments output have no rationale; edit: it has rationale as some digits may creep in, but can be shortened to \@namedef )
So, the hard-coded fixes which are added after loading of sphinxhighlight.sty overwrite style specs such as colors, and here the usage of italics for Comment.Special Pygments token type.
By the way, a PR should be done at Pygments to work usptream around the bug(s) and thus make those redefinitions unnecessary.
Pygments has now fixed the issue pygments/pygments#1708, so we will in future drop this entirely after checking Pygments version. Till then, we have to handle this better and find a wayt to respect the pygments style choices but still fix the issue.
jfbu
added a commit
to jfbu/sphinx
that referenced
this issue
Feb 13, 2021
Describe the bug
A clear and concise description of what the bug is.
sphinx/sphinx/texinputs/sphinx.sty
Lines 273 to 284 in 8b78638
goes some redefinition of latex macros from Pygments output. In the first case this is to keep baseline constant even in case of error tokens, in the second case to avoid a change to
\fboxsep
to propagate (I do not recall if this one is cosmetic only, but the first one is definitely needed).But using for example
pygments_style = 'autumn'
in conf.py one sees that original pygments LaTeXFormatter output is(I have edited it to avoid irrelevant
\expandafter\def\csname...
low-level stuff which is a slight bug of Pygments because unneeded; the@
character must have been allowed in latex macro names here, from the fact that the mark-up uses for example\PYG@it
with so scruples, so all the\expandafter\def...
from Pygments output have no rationale; edit: it has rationale as some digits may creep in, but can be shortened to\@namedef
)So, the hard-coded fixes which are added after loading of
sphinxhighlight.sty
overwrite style specs such as colors, and here the usage of italics for Comment.Special Pygments token type.By the way, a PR should be done at Pygments to work usptream around the bug(s) and thus make those redefinitions unnecessary.
Blame: 6cb517d (my bad, sorry, #4250)
Related
Environment info
The text was updated successfully, but these errors were encountered: