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 unable to render #1734

Closed
mtheiss opened this issue Mar 5, 2021 · 3 comments · Fixed by #1735 or #1737
Closed

Latex unable to render #1734

mtheiss opened this issue Mar 5, 2021 · 3 comments · Fixed by #1735 or #1737
Labels
A-formatting area: changes to formatters
Milestone

Comments

@mtheiss
Copy link

mtheiss commented Mar 5, 2021

In 2.8.0 Latex is unable to render a simple document (pdflatex -halt-on-error -shell-escape demo.tex) like

\documentclass{article}

\usepackage{minted}

\begin{document}
    X \mintinline{http}|abc| X
\end{document}

with the message:

! Missing number, treated as zero.
<to be read again> 
                   -
l.2 \PYG{err}{abc}

Might be related to #1710

@birkenfeld
Copy link
Member

please take a look @jfbu

@Anteru Anteru added the A-formatting area: changes to formatters label Mar 5, 2021
@Anteru Anteru added this to the 2.9 milestone Mar 5, 2021
@jfbu
Copy link
Contributor

jfbu commented Mar 5, 2021

@birkenfeld

This is a bug of minted which seems to assign catcode 11 to the - character in this context. It is not a bug of Pygments. I will investigate more later the minted aspect of this

(clearly this is the same as #1731 previous report)

but I can't now and only did enough to get to the conclusion I reported.

We could fix it via \setlength{\fboxsep}{\string -\fboxrule} (mind the space after \string) or TeX syntax \fboxsep=\string -\fboxrule (space after \string, else due to minted bug, TeX would see a control sequence with name \string- where - is part of the name).

With the above I get successful build of provided test document. But this should be a temporary hotfix as this is a minted bug and should be reported to minted maintainer. Should I make PR with it?

@birkenfeld
Copy link
Member

Thanks so much for the investigation!

jfbu added a commit to jfbu/pygments that referenced this issue Mar 5, 2021
This reverts already merged pygments#1735 (after a commit from pygments#1736 to fix it)
and applies the first envisioned method discussed in pygments#1734.

The reason is that the pygments#1735-pygments#1736 method only partially repairs the
minted compatibility.  Minted queries from Pygments the stylesheet
with a command prefix equal to the style name, which may contain
(at least, so far) characters such as - and _, which are not normally
allowed in LaTeX macros.  So it modifies the meaning of - and _ before
telling LaTeX to input the Pygments provided stylesheet.  Thus, retoring
the normal meaning of - e.g. must be done slightly differently than in
be defined using the weird minted -.

The pygments#1735-pygments#1736 method did fix compatibility with minted but *only* for
those style names not using a -, and it creates another issue if used with
style "paraiso-dark" e.g. which has a - character in its name.

"De guerre lasse", I feel it is simpler to use the somewhat strange
very localized hotfix of prefixing - by \string at the one spot where
we need it to be its normal self.  Hence this PR.

Fix pygments#1734.
jfbu added a commit to jfbu/pygments that referenced this issue Mar 5, 2021
This reverts already merged pygments#1735 (after a commit from pygments#1736 to fix it)
and applies the first envisioned method discussed in pygments#1734.

The reason is that the pygments#1735-pygments#1736 method only partially repairs the
minted compatibility.  Minted queries from Pygments the stylesheet
with a command prefix equal to the style name, which may contain
(at least, so far) characters such as - and _, which are not normally
allowed in LaTeX macros.  So it modifies the meaning of - and _ before
telling LaTeX to input the Pygments provided stylesheet.  Thus, restoring
the normal meaning of - e.g. must be done slightly differently than in
be defined using the weird minted -.

The pygments#1735-pygments#1736 method did fix compatibility with minted but *only* for
those style names not using a -, and it creates another issue if used with
style "paraiso-dark" e.g. which has a - character in its name.

"De guerre lasse", I feel it is simpler to use the somewhat strange
very localized hotfix of prefixing - by \string at the one spot where
we need it to be its normal self.  Hence this PR.

Fix pygments#1734.
jfbu added a commit to jfbu/pygments that referenced this issue Mar 5, 2021
This reverts already merged pygments#1735 (after a commit from pygments#1736 to fix it)
and applies the first envisioned method discussed in pygments#1734.

The reason is that the pygments#1735-pygments#1736 method only partially repairs the
minted compatibility.  Minted queries from Pygments the stylesheet
with a command prefix equal to the style name, which may contain
(at least, so far) characters such as - and _, which are not normally
allowed in LaTeX macros.  So it modifies the meaning of - and _ before
telling LaTeX to input the Pygments provided stylesheet.  Restoring
the normal meaning of - from inside the stylesheet must be carefully
localized: at top and bottom of stylesheets some macros will use in
their names the - and there the - must be the weird minted one, not
the normal one.

The pygments#1735-pygments#1736 method thus does fix compatibility with minted but *only*
for those style names not using a -, but it creates another issue if
used with e.g. style "paraiso-dark" which has a - character in its name.

"De guerre lasse", I feel it is simpler to use the somewhat strange
very localized hotfix of prefixing - by \string at the one spot where
we need it to be its normal self.  Hence this PR.

Fix pygments#1734.
This was referenced Mar 5, 2021
Anteru pushed a commit that referenced this issue Mar 6, 2021
* Fix #1735 pull request

* LaTeX: workaround to ensure compatibility with minted

This reverts already merged #1735 (after a commit from #1736 to fix it)
and applies the first envisioned method discussed in #1734.

The reason is that the #1735-#1736 method only partially repairs the
minted compatibility.  Minted queries from Pygments the stylesheet
with a command prefix equal to the style name, which may contain
(at least, so far) characters such as - and _, which are not normally
allowed in LaTeX macros.  So it modifies the meaning of - and _ before
telling LaTeX to input the Pygments provided stylesheet.  Restoring
the normal meaning of - from inside the stylesheet must be carefully
localized: at top and bottom of stylesheets some macros will use in
their names the - and there the - must be the weird minted one, not
the normal one.

The #1735-#1736 method thus does fix compatibility with minted but *only*
for those style names not using a -, but it creates another issue if
used with e.g. style "paraiso-dark" which has a - character in its name.

"De guerre lasse", I feel it is simpler to use the somewhat strange
very localized hotfix of prefixing - by \string at the one spot where
we need it to be its normal self.  Hence this PR.

Fix #1734.
Anteru added a commit that referenced this issue Mar 6, 2021
* Fix #1735 pull request

* LaTeX: workaround to ensure compatibility with minted

This reverts already merged #1735 (after a commit from #1736 to fix it)
and applies the first envisioned method discussed in #1734.

The reason is that the #1735-#1736 method only partially repairs the
minted compatibility.  Minted queries from Pygments the stylesheet
with a command prefix equal to the style name, which may contain
(at least, so far) characters such as - and _, which are not normally
allowed in LaTeX macros.  So it modifies the meaning of - and _ before
telling LaTeX to input the Pygments provided stylesheet.  Restoring
the normal meaning of - from inside the stylesheet must be carefully
localized: at top and bottom of stylesheets some macros will use in
their names the - and there the - must be the weird minted one, not
the normal one.

The #1735-#1736 method thus does fix compatibility with minted but *only*
for those style names not using a -, but it creates another issue if
used with e.g. style "paraiso-dark" which has a - character in its name.

"De guerre lasse", I feel it is simpler to use the somewhat strange
very localized hotfix of prefixing - by \string at the one spot where
we need it to be its normal self.  Hence this PR.

Fix #1734.
bob-beck pushed a commit to openbsd/ports that referenced this issue Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-formatting area: changes to formatters
Projects
None yet
4 participants