gpoore / minted

minted is a LaTeX package that provides syntax highlighting using the Pygments library. Highlighted source code can be customized using fancyvrb.
1.73k stars 125 forks source link

file extension `lol' cannot be used twice #390

Open ThexXTURBOXx opened 3 months ago

ThexXTURBOXx commented 3 months ago

After updating my local MiKTeX installation, I encounter the following error: ! Package tocbasic Error: file extensionlol' cannot be used twice .` (full log at the bottom of this issue).

I researched a bit and dug through my local files and my MiKTeX backup before updating and found that the listing package added the following line in 1.10a: \def\ext@lstlisting{lol}

So, I was able to boil this issue down to two packages: listings and minted in conjunction with KOMA scripts. The following MRE encounters the error described above:

\documentclass{scrbook}

\usepackage{listings}
\usepackage[newfloat]{minted}

\begin{document}

\end{document}

It should be noted that the issue can be fixed by removing the newfloat option from minted, which leads me to the suspicion that I should also report this error somewhere else... However, for now, the issue is probably correct here - please let me know if you think otherwise.

Full log ``` This is pdfTeX, Version 3.141592653-2.6-1.40.26 (MiKTeX 24.3) (preloaded format=pdflatex 2024.3.25) 25 MAR 2024 23:37 entering extended mode \write18 enabled. %&-line parsing enabled. **./texstudio_qHyVLC.tex (texstudio_qHyVLC.tex LaTeX2e <2023-11-01> patch level 1 L3 programming layer <2024-03-14> (E:\Program Files\MiKTeX\tex/latex/koma-script\scrbook.cls Document Class: scrbook 2023/07/07 v3.41 KOMA-Script document class (book) (E:\Program Files\MiKTeX\tex/latex/koma-script\scrkbase.sty Package: scrkbase 2023/07/07 v3.41 KOMA-Script package (KOMA-Script-dependent b asics and keyval usage) (E:\Program Files\MiKTeX\tex/latex/koma-script\scrbase.sty Package: scrbase 2023/07/07 v3.41 KOMA-Script package (KOMA-Script-independent basics and keyval usage) (E:\Program Files\MiKTeX\tex/latex/koma-script\scrlfile.sty Package: scrlfile 2023/07/07 v3.41 KOMA-Script package (file load hooks) (E:\Program Files\MiKTeX\tex/latex/koma-script\scrlfile-hook.sty Package: scrlfile-hook 2023/07/07 v3.41 KOMA-Script package (using LaTeX hooks) (E:\Program Files\MiKTeX\tex/latex/koma-script\scrlogo.sty Package: scrlogo 2023/07/07 v3.41 KOMA-Script package (logo) ))) (E:\Program Files\MiKTeX\tex/latex/graphics\keyval.sty Package: keyval 2022/05/29 v1.15 key=value parser (DPC) \KV@toks@=\toks17 ) Applying: [2021/05/01] Usage of raw or classic option list on input line 252. Already applied: [0000/00/00] Usage of raw or classic option list on input line 368. )) (E:\Program Files\MiKTeX\tex/latex/koma-script\tocbasic.sty Package: tocbasic 2023/07/07 v3.41 KOMA-Script package (handling toc-files) \scr@dte@tocline@numberwidth=\skip48 \scr@dte@tocline@numbox=\box51 ) Package tocbasic Info: omitting babel extension for `toc' (tocbasic) because of feature `nobabel' available (tocbasic) for `toc' on input line 135. Class scrbook Info: File `scrsize11pt.clo' used instead of (scrbook) file `scrsize11.clo' to setup font sizes on input line 2691 . (E:\Program Files\MiKTeX\tex/latex/koma-script\scrsize11pt.clo File: scrsize11pt.clo 2023/07/07 v3.41 KOMA-Script font size class option (11pt ) ) (E:\Program Files\MiKTeX\tex/latex/koma-script\typearea.sty Package: typearea 2023/07/07 v3.41 KOMA-Script package (type area) \ta@bcor=\skip49 \ta@div=\count188 \ta@hblk=\skip50 \ta@vblk=\skip51 \ta@temp=\skip52 \footheight=\skip53 Package typearea Info: These are the values describing the layout: (typearea) DIV = 10 (typearea) BCOR = 0.0pt (typearea) \paperwidth = 597.50793pt (typearea) \textwidth = 418.25555pt (typearea) DIV departure = -6% (typearea) \evensidemargin = 47.2316pt (typearea) \oddsidemargin = -12.5192pt (typearea) \paperheight = 845.04694pt (typearea) \textheight = 595.80026pt (typearea) \topmargin = -25.16531pt (typearea) \headheight = 17.0pt (typearea) \headsep = 20.40001pt (typearea) \topskip = 11.0pt (typearea) \footskip = 47.6pt (typearea) \baselineskip = 13.6pt (typearea) on input line 1799. ) \c@part=\count189 \c@chapter=\count190 \c@section=\count191 \c@subsection=\count192 \c@subsubsection=\count193 \c@paragraph=\count194 \c@subparagraph=\count195 \scr@dte@chapter@maxnumwidth=\skip54 Class scrbook Info: using compatibility default `afterindent=bysign' (scrbook) for `\chapter on input line 5990. \scr@dte@section@maxnumwidth=\skip55 Class scrbook Info: using compatibility default `runin=bysign' (scrbook) for `\section on input line 6001. Class scrbook Info: using compatibility default `afterindent=bysign' (scrbook) for `\section on input line 6001. \scr@dte@part@maxnumwidth=\skip56 Class scrbook Info: using compatibility default `afterindent=true' (scrbook) for `\part on input line 6010. \scr@dte@subsection@maxnumwidth=\skip57 Class scrbook Info: using compatibility default `runin=bysign' (scrbook) for `\subsection on input line 6020. Class scrbook Info: using compatibility default `afterindent=bysign' (scrbook) for `\subsection on input line 6020. \scr@dte@subsubsection@maxnumwidth=\skip58 Class scrbook Info: using compatibility default `runin=bysign' (scrbook) for `\subsubsection on input line 6030. Class scrbook Info: using compatibility default `afterindent=bysign' (scrbook) for `\subsubsection on input line 6030. \scr@dte@paragraph@maxnumwidth=\skip59 Class scrbook Info: using compatibility default `runin=bysign' (scrbook) for `\paragraph on input line 6041. Class scrbook Info: using compatibility default `afterindent=bysign' (scrbook) for `\paragraph on input line 6041. \scr@dte@subparagraph@maxnumwidth=\skip60 Class scrbook Info: using compatibility default `runin=bysign' (scrbook) for `\subparagraph on input line 6051. Class scrbook Info: using compatibility default `afterindent=bysign' (scrbook) for `\subparagraph on input line 6051. \abovecaptionskip=\skip61 \belowcaptionskip=\skip62 \c@pti@nb@sid@b@x=\box52 Package tocbasic Info: omitting babel extension for `lof' (tocbasic) because of feature `nobabel' available (tocbasic) for `lof' on input line 7242. \scr@dte@figure@maxnumwidth=\skip63 \c@figure=\count196 Package tocbasic Info: omitting babel extension for `lot' (tocbasic) because of feature `nobabel' available (tocbasic) for `lot' on input line 7259. \scr@dte@table@maxnumwidth=\skip64 \c@table=\count197 Class scrbook Info: Redefining `\numberline' on input line 7430. \bibindent=\dimen140 ) (E:\Program Files\MiKTeX\tex/latex/listings\listings.sty \lst@mode=\count198 \lst@gtempboxa=\box53 \lst@token=\toks18 \lst@length=\count199 \lst@currlwidth=\dimen141 \lst@column=\count266 \lst@pos=\count267 \lst@lostspace=\dimen142 \lst@width=\dimen143 \lst@newlines=\count268 \lst@lineno=\count269 \lst@maxwidth=\dimen144 (E:\Program Files\MiKTeX\tex/latex/listings\lstpatch.sty File: lstpatch.sty 2024/03/11 1.10a (Carsten Heinz) ) (E:\Program Files\MiKTeX\tex/latex/listings\lstmisc.sty File: lstmisc.sty 2024/03/11 1.10a (Carsten Heinz) \c@lstnumber=\count270 \lst@skipnumbers=\count271 \lst@framebox=\box54 ) (E:\Program Files\MiKTeX\tex/latex/listings\listings.cfg File: listings.cfg 2024/03/11 1.10a listings configuration )) Package: listings 2024/03/11 1.10a (Carsten Heinz) (E:\Program Files\MiKTeX\tex/latex/minted\minted.sty Package: minted 2023/12/18 v2.9 Yet another Pygments shim for LaTeX (E:\Program Files\MiKTeX\tex/latex/kvoptions\kvoptions.sty Package: kvoptions 2022-06-15 v3.15 Key value format for package options (HO) (E:\Program Files\MiKTeX\tex/generic/ltxcmds\ltxcmds.sty Package: ltxcmds 2023-12-04 v1.26 LaTeX kernel commands for general use (HO) ) (E:\Program Files\MiKTeX\tex/latex/kvsetkeys\kvsetkeys.sty Package: kvsetkeys 2022-10-05 v1.19 Key value parser (HO) )) (E:\Program Files\MiKTeX\tex/latex/fvextra\fvextra.sty Package: fvextra 2023/11/28 v1.6.1 fvextra - extensions and patches for fancyvr b (E:\Program Files\MiKTeX\tex/latex/etoolbox\etoolbox.sty Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW) \etb@tempcnta=\count272 ) (E:\Program Files\MiKTeX\tex/latex/fancyvrb\fancyvrb.sty Package: fancyvrb 2024/01/20 4.5c verbatim text (tvz,hv) \FV@CodeLineNo=\count273 \FV@InFile=\read2 \FV@TabBox=\box55 \c@FancyVerbLine=\count274 \FV@StepNumber=\count275 \FV@OutFile=\write3 ) (E:\Program Files\MiKTeX\tex/latex/upquote\upquote.sty Package: upquote 2012/04/19 v1.3 upright-quote and grave-accent glyphs in verba tim ) (E:\Program Files\MiKTeX\tex/latex/lineno\lineno.sty Package: lineno 2023/05/20 line numbers on paragraphs v5.3 \linenopenalty=\count276 \output=\toks19 \linenoprevgraf=\count277 \linenumbersep=\dimen145 \linenumberwidth=\dimen146 \c@linenumber=\count278 \c@pagewiselinenumber=\count279 \c@LN@truepage=\count280 \c@internallinenumber=\count281 \c@internallinenumbers=\count282 \quotelinenumbersep=\dimen147 \bframerule=\dimen148 \bframesep=\dimen149 \bframebox=\box56 LaTeX Info: Redefining \\ on input line 3180. ) \c@FancyVerbWriteLine=\count283 \c@FancyVerbBufferIndex=\count284 \c@FancyVerbBufferLength=\count285 \c@FancyVerbBufferLine=\count286 \c@FV@oldbufferlength=\count287 \c@FV@TrueTabGroupLevel=\count288 \c@FV@TrueTabCounter=\count289 \FV@TabBox@Group=\box57 \FV@TmpLength=\skip65 \c@FV@HighlightLinesStart=\count290 \c@FV@HighlightLinesStop=\count291 \FV@LoopCount=\count292 \FV@NCharsBox=\box58 \FV@BreakIndent=\dimen150 \FV@BreakIndentNChars=\count293 \FV@BreakSymbolSepLeft=\dimen151 \FV@BreakSymbolSepLeftNChars=\count294 \FV@BreakSymbolSepRight=\dimen152 \FV@BreakSymbolSepRightNChars=\count295 \FV@BreakSymbolIndentLeft=\dimen153 \FV@BreakSymbolIndentLeftNChars=\count296 \FV@BreakSymbolIndentRight=\dimen154 \FV@BreakSymbolIndentRightNChars=\count297 \c@FancyVerbLineBreakLast=\count298 \FV@LineBox=\box59 \FV@LineIndentBox=\box60 \c@FV@BreakBufferDepth=\count299 \FV@LineWidth=\dimen155 ) (E:\Program Files\MiKTeX\tex/latex/base\ifthen.sty Package: ifthen 2022/04/13 v1.1d Standard LaTeX ifthen package (DPC) ) (E:\Program Files\MiKTeX\tex/latex/tools\shellesc.sty Package: shellesc 2023/07/08 v1.0d unified shell escape interface for LaTeX Package shellesc Info: Unrestricted shell escape enabled on input line 75. ) (E:\Program Files\MiKTeX\tex/latex/ifplatform\ifplatform.sty Package: ifplatform 2017/10/13 v0.4a Testing for the operating system (E:\Program Files\MiKTeX\tex/generic/pdftexcmds\pdftexcmds.sty Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO ) (E:\Program Files\MiKTeX\tex/generic/infwarerr\infwarerr.sty Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO) ) (E:\Program Files\MiKTeX\tex/generic/iftex\iftex.sty Package: iftex 2022/02/03 v1.0f TeX engine tests ) Package pdftexcmds Info: \pdf@primitive is available. Package pdftexcmds Info: \pdf@ifprimitive is available. Package pdftexcmds Info: \pdfdraftmode found. ) (E:\Program Files\MiKTeX\tex/generic/catchfile\catchfile.sty Package: catchfile 2019/12/09 v1.8 Catch the contents of a file (HO) (E:\Program Files\MiKTeX\tex/generic/etexcmds\etexcmds.sty Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO) )) (E:\Program Files\MiKTeX\tex/generic/iftex\ifluatex.sty Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead. )) (E:\Program Files\MiKTeX\tex/latex/xstring\xstring.sty (E:\Program Files\MiKTeX\tex/generic/xstring\xstring.tex \xs_counta=\count300 \xs_countb=\count301 ) Package: xstring 2023/08/22 v1.86 String manipulations (CT) ) (E:\Program Files\MiKTeX\tex/latex/framed\framed.sty Package: framed 2011/10/22 v 0.96: framed or shaded text with page breaks \OuterFrameSep=\skip66 \fb@frw=\dimen156 \fb@frh=\dimen157 \FrameRule=\dimen158 \FrameSep=\dimen159 ) (E:\Program Files\MiKTeX\tex/latex/newfloat\newfloat.sty Package: newfloat 2023/10/01 v1.2 Defining new floating environments (AR) ) \minted@appexistsfile=\read3 \minted@bgbox=\box61 \minted@code=\write4 \c@minted@FancyVerbLineTemp=\count302 \c@minted@pygmentizecounter=\count303 Package newfloat Info: New float `listing' with options `fileext=lol,placement= tbp' on input line 1221. \c@listing=\count304 \newfloat@ftype=\count305 Package newfloat Info: float type `listing'=8 on input line 1221. Package tocbasic Info: omitting babel extension for `lol' (tocbasic) because of missing \bbl@set@language on input line 1221. ) runsystem(if not exist _minted-texstudio_qHyVLC mkdir _minted-texstudio_qHyVLC) ...executed. (E:\Program Files\MiKTeX\tex/latex/xcolor\xcolor.sty Package: xcolor 2023/11/15 v3.01 LaTeX color extensions (UK) (E:\Program Files\MiKTeX\tex/latex/graphics-cfg\color.cfg File: color.cfg 2016/01/02 v1.6 sample color configuration ) Package xcolor Info: Driver file: pdftex.def on input line 274. (E:\Program Files\MiKTeX\tex/latex/graphics-def\pdftex.def File: pdftex.def 2022/09/22 v1.2b Graphics/color driver for pdftex ) (E:\Program Files\MiKTeX\tex/latex/graphics\mathcolor.ltx) Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1350. Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1354. Package xcolor Info: Model `RGB' extended on input line 1366. Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1368. Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1369. Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1370. Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1371. Package xcolor Info: Model `Gray' substituted by `gray' on input line 1372. Package xcolor Info: Model `wave' substituted by `hsb' on input line 1373. ) runsystem(for ^%i in (pygmentize.exe pygmentize.bat pygmentize.cmd) do set > te xstudio_qHyVLC.aex > texstudio_qHyVLC.aex)...executed. runsystem(del texstudio_qHyVLC.aex)...executed. (E:\Program Files\MiKTeX\tex/latex/l3backend\l3backend-pdftex.def File: l3backend-pdftex.def 2024-03-14 L3 backend support: PDF output (pdfTeX) \l__color_backend_stack_int=\count306 \l__pdf_internal_box=\box62 ) (texstudio_qHyVLC.aux) \openout1 = `texstudio_qHyVLC.aux'. LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 9. LaTeX Font Info: ... okay on input line 9. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 9. LaTeX Font Info: ... okay on input line 9. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 9. LaTeX Font Info: ... okay on input line 9. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 9. LaTeX Font Info: ... okay on input line 9. LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 9. LaTeX Font Info: ... okay on input line 9. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 9. LaTeX Font Info: ... okay on input line 9. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 9. LaTeX Font Info: ... okay on input line 9. Package scrbase Info: activating english \partname on input line 9. Package scrbase Info: activating english \chaptername on input line 9. Package scrbase Info: activating english \appendixname on input line 9. Package scrbase Info: activating english \figurename on input line 9. Package scrbase Info: activating english \tablename on input line 9. Package scrbase Info: activating english \contentsname on input line 9. Package scrbase Info: activating english \listfigurename on input line 9. Package scrbase Info: activating english \listtablename on input line 9. Package scrbase Info: activating english \bibname on input line 9. Package scrbase Info: activating english \indexname on input line 9. (E:\Program Files\MiKTeX\tex/latex/base\textcomp.sty Package: textcomp 2020/02/02 v2.0n Standard LaTeX package ) \c@lstlisting=\count307 ! Package tocbasic Error: file extension `lol' cannot be used twice . See the tocbasic package documentation for explanation. Type H for immediate help. ... l.9 \begin{document} Here is how much of TeX's memory you used: 9396 strings out of 474424 192513 string characters out of 5751554 1928496 words of memory out of 5000000 31689 multiletter control sequences out of 15000+600000 558369 words of font info for 37 fonts, out of 8000000 for 9000 1141 hyphenation exceptions out of 8191 108i,1n,107p,10913b,288s stack positions out of 10000i,1000n,20000p,200000b,200000s ! ==> Fatal error occurred, no output PDF file produced! ```
komascript commented 3 months ago

Package tocbasic provides a security mechanism to prevent unwanted usage of the same auxiliary file for different lists. Both listings and minted use the same file extension lol. IMHO in this case this is wanted. But with option newfloat package minted uses package newfloat to define a new float with a new file extension.

Note: newfloat correctly uses tocbasic's \addtotoclist to register file extensions, if the command exists.

To avoid the problem, either minted should prevent the second registering of the extension if listings is loaded, or listings should prevent the second registering of the extension if minted is loaded (I will ask Jobst Hoffmann to do so).

As a workaround, you can use:

\documentclass{scrbook}
\usepackage{listings}
\usepackage[newfloat]{minted}
% Add the following lines, wherever you want.
\makeatletter
\AddToHook{begindocument/before}{\@ifpackageloaded{minted}{\removefromtoclist[float]{lol}}{}}
\makeatother
\begin{document}

\end{document}

or simply:

\documentclass{scrbook}
\usepackage{listings}
\usepackage[newfloat]{minted}
\removefromtoclist[float]{lol}% must be after loading `minted`.
\begin{document}

\end{document}
ThexXTURBOXx commented 3 months ago

@komascript A response from the guy himself, very nice to see! Thank you very much for your explanation! This whole issue makes sense to me now and I will be patiently waiting for a fix. Maybe it is better to close this very issue here then - since the fix should apparently rather land in listings. However, I let the maintainer(s) here decide and leave it open for the time being. I also wanted to write an email to Jobst Hoffmann about this issue yesterday, but I wanted to first try to get a response here. So, you can gladly go ahead and email him about this - or if you have something better to do, I can also do so!

komascript commented 3 months ago

The collaboration with Jobs works very well. He is primarily interested in facilitating solutions — just like me. That's why I've already wrote him and suggested a (somewhat more universal) change to listings.

In the end, it is only important that an extension is registered exactly once. Otherwise, for example, chapter spacings would be entered several times in the directory. This is why tocbasic also refuses multiple registration.