Closed dbitouze closed 2 years ago
Reproducible with minted
+ autogobble
option.
Direct cause is the inline python script called by minted
when autogobble
is used: check the runsystem(import os; ... fvstopnum = \FancyVerbStopNum ...)
in log. (The backslash character \
is responsible for the python error SyntaxError: unexpected character after line continuation character
.) Here \FancyVerbStopNum
should expand to its value.
Primary cause is, recent change in fancyvrb
modifies the initial definition of \FancyVerbStopNum
which makes a flaw in minted
uncovered. \FancyVerbStopNum
is s (count or dimension) register, but minted
uses
\edef\minted@autogobblecmd{%
...
\ifx\FancyVerbStopNum\z@ 0\else\FancyVerbStopNum\fi
...
}
It should be \else\the\FancyVerbStopNum\fi
.
I've reported this to minted
, see gpoore/minted#316, and you can also find a workaround there.
I also reported the fancyvrb
problem to minted
(https://github.com/gpoore/minted/issues/315) and Geoffry Poore already wrote that it is going to be fixed.
Meanwhile, you can use the workaround of @muzimuzhi or, if autogobble
is not relevant for you, setting (temporarily)
\tcbsetforeverylayer{minted options={tabsize=2,fontsize=\small,breaklines,autogobble=false}}
removes the default autogobble
feature.
I've reported this to
minted
, see gpoore/minted#316, and you can also find a workaround there.
I'm not sure but it seems most of the time you only need to patch \minted@autogobble
.
Meanwhile, you can use the workaround of @muzimuzhi or, if
autogobble
is not relevant for you, setting (temporarily)\tcbsetforeverylayer{minted options={tabsize=2,fontsize=\small,breaklines,autogobble=false}}
removes the default
autogobble
feature.
With tcb's hooks
library, this can be shorten to \tcbsetforeverylayer{minted options app={autogobble=false}}
.
Since the official release of the adapted minted
package may take some time longer, I will add a temporary patch to the minted
library which is based on @muzimuzhi proposal.
Note my original proposal missed \relax
to terminate the \numexpr
, see discussions under https://github.com/gpoore/minted/commit/4280e7fb841d2d3487c3b25b130104284ae532da and the fix https://github.com/gpoore/minted/commit/c012fb84343f86c9bc80f39b009e115a0a356d62.
The missing \relax
es are only needed for the patch for fivesum computation (in \minted@pygmentize
), which is a python implementation of md5 computation. The python inline script is only used when an old engine (pdftex in texlive 2005 or older, xetex in texlive 2015 or older) that haven't provided related primitive is used.
This explains my previous finding
I've reported this to
minted
, see gpoore/minted#316, and you can also find a workaround there.I'm not sure but it seems most of the time you only need to patch
\minted@autogobble
.
The following git diff
results could account for a minimal fix, while it's totally ok to append \relax
to both \minted@use@FancyVerbStartNum
and \minted@use@FancyVerbStopNum
.
diff --git a/tex/latex/tcolorbox/tcbminted.code.tex b/tex/latex/tcolorbox/tcbminted.code.tex
index 6c3a2ee..e92d728 100644
--- a/tex/latex/tcolorbox/tcbminted.code.tex
+++ b/tex/latex/tcolorbox/tcbminted.code.tex
@@ -36,11 +36,11 @@
% patch for fivesum computation
\xpatchcmd*\minted@pygmentize%
{\ifx\FancyVerbStartNum\z@ 0\else\FancyVerbStartNum\fi}%
- {\minted@use@FancyVerbStartNum}%
+ {\minted@use@FancyVerbStartNum\relax}%
{}{}%
\xpatchcmd*\minted@pygmentize%
{\ifx\FancyVerbStopNum\z@ 0\else\FancyVerbStopNum\fi}%
- {\minted@use@FancyVerbStopNum}%
+ {\minted@use@FancyVerbStopNum\relax}%
{}{}%
% patch for option "autogobble"
\xpatchcmd\minted@autogobble%
Oh, i missed this. It is too late for 5.0.0
, but I will correct this for the next version, if a minted
update is not released before. Fortunately, this should not affect too many (none?) people.
Fortunately, this should not affect too many (none?) people.
Yes.
minted
: Patch \tcbTemporaryPatchMintedFancyvrb
fixed (issue #158)
minted
: Temporary patch \tcbTemporaryPatchMintedFancyvrb
removed
because of update for package minted
(2021/12/24). This is now the required
version for tcolorbox
(issue #158)
The
minted
example, page 321 of the documentation oftcolorbox
version4.51
, works smoothly with justminted
:but not with
\tcbuselibrary{minted}
:the error being:
Here is my file list: