使用 Minted 时 LaTeX 紧急停止

使用 Minted 时 LaTeX 紧急停止

在 Texstudio 中使用 minted 时,编译器会抛出一个我无法解决的错误,也许有更多 LaTeX 经验的人可以给出一些提示。我很乐意提供所需的大量信息。

环境:

  • MS Windows 11(版本 10.0.22000.739)
  • Tex live 2022(pdfTeX 3.141592653-2.6-1.40.24)
  • TeXstudio 编辑器

问题描述:

使用 minted 包时,编译器会紧急停止。-shell-escape 参数已在 Texstudio 命令配置中设置:

pdflatex.exe -synctex=1  -interaction=nonstopmode -shell-escape %.tex

类似问题的其他答案建议打开批处理模式而不是非停止模式,但这没有什么区别。

错误信息:

This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex 2022.5.6)  10 JUL 2022 18:25
entering extended mode
 \write18 enabled.
 %&-line parsing enabled.
**main.tex
(./main.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-04-29>
(c:/texlive/2022/texmf-dist/tex/latex/koma-script/scrbook.cls
Document Class: scrbook 2021/11/13 v3.35 KOMA-Script document class (book)
(c:/texlive/2022/texmf-dist/tex/latex/koma-script/scrkbase.sty
Package: scrkbase 2021/11/13 v3.35 KOMA-Script package (KOMA-Script-dependent b
asics and keyval usage)

(c:/texlive/2022/texmf-dist/tex/latex/koma-script/scrbase.sty
Package: scrbase 2021/11/13 v3.35 KOMA-Script package (KOMA-Script-independent 
basics and keyval usage)

(c:/texlive/2022/texmf-dist/tex/latex/koma-script/scrlfile.sty
Package: scrlfile 2021/11/13 v3.35 KOMA-Script package (file load hooks)

(c:/texlive/2022/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty
Package: scrlfile-hook 2021/11/13 v3.35 KOMA-Script package (using LaTeX hooks)


(c:/texlive/2022/texmf-dist/tex/latex/koma-script/scrlogo.sty
Package: scrlogo 2021/11/13 v3.35 KOMA-Script package (logo)
)))
(c:/texlive/2022/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks16
)
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.
))
(c:/texlive/2022/texmf-dist/tex/latex/koma-script/tocbasic.sty
Package: tocbasic 2021/11/13 v3.35 KOMA-Script package (handling toc-files)
\scr@dte@tocline@numberwidth=\skip47
\scr@dte@tocline@numbox=\box50
)
Package tocbasic Info: babel extension for `toc' omitted
(tocbasic)             because of missing \bbl@set@language on input line 137.
Class scrbook Info: File `scrsize11pt.clo' used instead of
(scrbook)           file `scrsize11.clo' to setup font sizes on input line 2490
.

(c:/texlive/2022/texmf-dist/tex/latex/koma-script/scrsize11pt.clo
File: scrsize11pt.clo 2021/11/13 v3.35 KOMA-Script font size class option (11pt
)
)
(c:/texlive/2022/texmf-dist/tex/latex/koma-script/typearea.sty
Package: typearea 2021/11/13 v3.35 KOMA-Script package (type area)
\ta@bcor=\skip48
\ta@div=\count185
\ta@hblk=\skip49
\ta@vblk=\skip50
\ta@temp=\skip51
\footheight=\skip52
Package typearea Info: These are the values describing the layout:
(typearea)             DIV  = 12
(typearea)             BCOR = 14.22636pt
(typearea)             \paperwidth      = 597.50793pt
(typearea)              \textwidth      = 437.46118pt
(typearea)              DIV departure   = -11%
(typearea)              \evensidemargin = 24.9436pt
(typearea)              \oddsidemargin  = -9.43683pt
(typearea)             \paperheight     = 845.04694pt
(typearea)              \textheight     = 636.60028pt
(typearea)              \topmargin      = -39.24942pt
(typearea)              \headheight     = 17.0pt
(typearea)              \headsep        = 20.40001pt
(typearea)              \topskip        = 11.0pt
(typearea)              \footskip       = 47.6pt
(typearea)              \baselineskip   = 13.6pt
(typearea)              on input line 1743.
)
\c@part=\count186
\c@chapter=\count187
\c@section=\count188
\c@subsection=\count189
\c@subsubsection=\count190
\c@paragraph=\count191
\c@subparagraph=\count192
\scr@dte@chapter@maxnumwidth=\skip53
Class scrbook Info: using compatibility default `afterindent=bysign'
(scrbook)           for `\chapter on input line 5715.
\scr@dte@section@maxnumwidth=\skip54
Class scrbook Info: using compatibility default `runin=bysign'
(scrbook)           for `\section on input line 5726.
Class scrbook Info: using compatibility default `afterindent=bysign'
(scrbook)           for `\section on input line 5726.
\scr@dte@part@maxnumwidth=\skip55
Class scrbook Info: using compatibility default `afterindent=true'
(scrbook)           for `\part on input line 5735.
\scr@dte@subsection@maxnumwidth=\skip56
Class scrbook Info: using compatibility default `runin=bysign'
(scrbook)           for `\subsection on input line 5745.
Class scrbook Info: using compatibility default `afterindent=bysign'
(scrbook)           for `\subsection on input line 5745.
\scr@dte@subsubsection@maxnumwidth=\skip57
Class scrbook Info: using compatibility default `runin=bysign'
(scrbook)           for `\subsubsection on input line 5755.
Class scrbook Info: using compatibility default `afterindent=bysign'
(scrbook)           for `\subsubsection on input line 5755.
\scr@dte@paragraph@maxnumwidth=\skip58
Class scrbook Info: using compatibility default `runin=bysign'
(scrbook)           for `\paragraph on input line 5766.
Class scrbook Info: using compatibility default `afterindent=bysign'
(scrbook)           for `\paragraph on input line 5766.
\scr@dte@subparagraph@maxnumwidth=\skip59
Class scrbook Info: using compatibility default `runin=bysign'
(scrbook)           for `\subparagraph on input line 5776.
Class scrbook Info: using compatibility default `afterindent=bysign'
(scrbook)           for `\subparagraph on input line 5776.
\abovecaptionskip=\skip60
\belowcaptionskip=\skip61
\c@pti@nb@sid@b@x=\box51
Package tocbasic Info: babel extension for `lof' omitted
(tocbasic)             because of missing \bbl@set@language on input line 6962.

\scr@dte@figure@maxnumwidth=\skip62
\c@figure=\count193
Package tocbasic Info: babel extension for `lot' omitted
(tocbasic)             because of missing \bbl@set@language on input line 6978.

\scr@dte@table@maxnumwidth=\skip63
\c@table=\count194
Class scrbook Info: Redefining `\numberline' on input line 7146.
\bibindent=\dimen138
)
(c:/texlive/2022/texmf-dist/tex/latex/minted/minted.sty
Package: minted 2021/12/24 v2.6 Yet another Pygments shim for LaTeX

(c:/texlive/2022/texmf-dist/tex/latex/kvoptions/kvoptions.sty
Package: kvoptions 2020-10-07 v3.14 Key value format for package options (HO)

(c:/texlive/2022/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
)
(c:/texlive/2022/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty
Package: kvsetkeys 2019/12/15 v1.18 Key value parser (HO)
))
(c:/texlive/2022/texmf-dist/tex/latex/fvextra/fvextra.sty
Package: fvextra 2019/02/04 v1.4 fvextra - extensions and patches for fancyvrb

(c:/texlive/2022/texmf-dist/tex/latex/base/ifthen.sty
Package: ifthen 2020/11/24 v1.1c Standard LaTeX ifthen package (DPC)
)
(c:/texlive/2022/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count195
)
(c:/texlive/2022/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Package: fancyvrb 2022/04/12 4.2 verbatim text (tvz,hv)
\FV@CodeLineNo=\count196
\FV@InFile=\read2
\FV@TabBox=\box52
\c@FancyVerbLine=\count197
\FV@StepNumber=\count198
\FV@OutFile=\write3
)
(c:/texlive/2022/texmf-dist/tex/latex/upquote/upquote.sty
Package: upquote 2012/04/19 v1.3 upright-quote and grave-accent glyphs in verba
tim
)
(c:/texlive/2022/texmf-dist/tex/latex/lineno/lineno.sty
Package: lineno 2005/11/02 line numbers on paragraphs v4.41
\linenopenalty=\count199
\output=\toks17
\linenoprevgraf=\count266
\linenumbersep=\dimen139
\linenumberwidth=\dimen140
\c@linenumber=\count267
\c@pagewiselinenumber=\count268
\c@LN@truepage=\count269
\c@internallinenumber=\count270
\c@internallinenumbers=\count271
\quotelinenumbersep=\dimen141
\bframerule=\dimen142
\bframesep=\dimen143
\bframebox=\box53
LaTeX Info: Redefining \\ on input line 3056.
)
\c@FV@TrueTabGroupLevel=\count272
\c@FV@TrueTabCounter=\count273
\FV@TabBox@Group=\box54
\FV@TmpLength=\skip64
\c@FV@HighlightLinesStart=\count274
\c@FV@HighlightLinesStop=\count275
\FV@LoopCount=\count276
\FV@NCharsBox=\box55
\FV@BreakIndent=\dimen144
\FV@BreakIndentNChars=\count277
\FV@BreakSymbolSepLeft=\dimen145
\FV@BreakSymbolSepLeftNChars=\count278
\FV@BreakSymbolSepRight=\dimen146
\FV@BreakSymbolSepRightNChars=\count279
\FV@BreakSymbolIndentLeft=\dimen147
\FV@BreakSymbolIndentLeftNChars=\count280
\FV@BreakSymbolIndentRight=\dimen148
\FV@BreakSymbolIndentRightNChars=\count281
\c@FancyVerbLineBreakLast=\count282
\FV@LineBox=\box56
\FV@LineIndentBox=\box57
\FV@LineWidth=\dimen149
)
(c:/texlive/2022/texmf-dist/tex/latex/tools/calc.sty
Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
\calc@Acount=\count283
\calc@Bcount=\count284
\calc@Adimen=\dimen150
\calc@Bdimen=\dimen151
\calc@Askip=\skip65
\calc@Bskip=\skip66
LaTeX Info: Redefining \setlength on input line 80.
LaTeX Info: Redefining \addtolength on input line 81.
\calc@Ccount=\count285
\calc@Cskip=\skip67
)
(c:/texlive/2022/texmf-dist/tex/latex/tools/shellesc.sty
Package: shellesc 2019/11/08 v1.0c unified shell escape interface for LaTeX
Package shellesc Info: Unrestricted shell escape enabled on input line 75.
)
(c:/texlive/2022/texmf-dist/tex/latex/ifplatform/ifplatform.sty
Package: ifplatform 2017/10/13 v0.4a Testing for the operating system

(c:/texlive/2022/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO
)

(c:/texlive/2022/texmf-dist/tex/generic/infwarerr/infwarerr.sty
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
)
(c:/texlive/2022/texmf-dist/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.
)
(c:/texlive/2022/texmf-dist/tex/generic/catchfile/catchfile.sty
Package: catchfile 2019/12/09 v1.8 Catch the contents of a file (HO)

(c:/texlive/2022/texmf-dist/tex/generic/etexcmds/etexcmds.sty
Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
))
(c:/texlive/2022/texmf-dist/tex/generic/iftex/ifluatex.sty
Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.
))
(c:/texlive/2022/texmf-dist/tex/generic/xstring/xstring.sty
(c:/texlive/2022/texmf-dist/tex/generic/xstring/xstring.tex
\integerpart=\count286
\decimalpart=\count287
)
Package: xstring 2021/07/21 v1.84 String manipulations (CT)
)
(c:/texlive/2022/texmf-dist/tex/latex/framed/framed.sty
Package: framed 2011/10/22 v 0.96: framed or shaded text with page breaks
\OuterFrameSep=\skip68
\fb@frw=\dimen152
\fb@frh=\dimen153
\FrameRule=\dimen154
\FrameSep=\dimen155
)
(c:/texlive/2022/texmf-dist/tex/latex/float/float.sty
Package: float 2001/11/08 v1.3d Float enhancements (AL)
\c@float@type=\count288
\float@exts=\toks18
\float@box=\box58
\@float@everytoks=\toks19
\@floatcapt=\box59
)
\minted@appexistsfile=\read3
\minted@bgbox=\box60
\minted@code=\write4
\c@minted@FancyVerbLineTemp=\count289
\c@minted@pygmentizecounter=\count290
\@float@every@listing=\toks20
\c@listing=\count291
)
runsystem(if not exist _minted-main mkdir _minted-main)...executed.


(c:/texlive/2022/texmf-dist/tex/latex/xcolor/xcolor.sty
Package: xcolor 2021/10/31 v2.13 LaTeX color extensions (UK)

(c:/texlive/2022/texmf-dist/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 227.

(c:/texlive/2022/texmf-dist/tex/latex/graphics-def/pdftex.def
File: pdftex.def 2020/10/05 v1.2a Graphics/color driver for pdftex
)
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1352.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1356.
Package xcolor Info: Model `RGB' extended on input line 1368.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1370.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1371.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1372.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1373.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1374.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1375.
)
runsystem(for ^%i in (pygmentize.exe pygmentize.bat pygmentize.cmd) do set > ma
in.aex <nul: /p x=^%~$PATH:i>> main.aex)...executed.


! Emergency stop.
<read 3> 
         
l.5 \begin{document}
                    ^^M
*** (cannot \read from terminal in nonstop modes)

 
Here is how much of TeX's memory you used:
 7574 strings out of 480171
 161188 string characters out of 5891539
 629053 words of memory out of 5000000
 25482 multiletter control sequences out of 15000+600000
 469559 words of font info for 29 fonts, out of 8000000 for 9000
 36 hyphenation exceptions out of 8191
 108i,1n,106p,10599b,271s stack positions out of 10000i,1000n,20000p,200000b,200000s
!  ==> Fatal error occurred, no output PDF file produced!

主文件:

\documentclass[bibliography=totoc,listof=totoc,BCOR=5mm,DIV=12]{scrbook}

\usepackage{minted}

\begin{document}
\begin{minted}[fontsize=\small]{yaml}
stack: exchange
  - tex: stuff
    platform: windows
\end{minted}
\end{document} 

更新:

我重新安装了 Tex 环境,但仍然出现相同的错误。但现在我得到了额外的输出,也许这有助于缩小问题范围。

启动进程:pdflatex.exe -synctex=1 -shell-escape -interaction=nonstopmode "main".tex

Use of uninitialized value $ver in scalar chomp at C:/texlive/2022/tlpkg/TeXLive/TLWinGoo.pm line 196. Use of uninitialized value $ver in substitution (s///) at C:/texlive/2022/tlpkg/TeXLive/TLWinGoo.pm line 197. Use of uninitialized value $ver in substitution (s///) at C:/texlive/2022/tlpkg/TeXLive/TLWinGoo.pm line 197.
fmtutil: fmtutil is using the following fmtutil.cnf files (in precedence order): fmtutil: c:/texlive/2022/texmf-dist/web2c/fmtutil.cnf fmtutil: fmtutil is using the following fmtutil.cnf file for writing changes: fmtutil: c:/users/luke/.texlive2022/texmf-config/web2c/fmtutil.cnf fmtutil [INFO]: writing formats under c:/users/luke/.texlive2022/texmf-var/web2c fmtutil [INFO]: --- remaking pdflatex with pdftex
Can't spawn "cmd.exe": No such file or directory at c:\texlive\2022\texmf-dist\scripts\texlive\fmtutil.pl line 718. fmtutil [WARNING]: inifile pdflatex.ini for pdflatex/pdftex not found.
fmtutil [INFO]: not selected formats: 32 fmtutil [INFO]: failed to build: 1 (pdftex/pdflatex) fmtutil [INFO]: total formats: 33 fmtutil [INFO]: exiting with status 1
C:\texlive\2022\bin\win32\runscript.tlu:915: command failed with exit code 1: perl.exe c:\texlive\2022\texmf-dist\scripts\texlive\fmtutil.pl --user --byfmt pdflatex
Running the command C:\texlive\2022\bin\win32\fmtutil-user.exe
kpathsea: Running mktexfmt pdflatex.fmt The command name is C:\texlive\2022\bin\win32\mktexfmt
Prozess endete mit Fehler(n)

答案1

解决方案:

经过多次重新安装,我终于找到了导致错误的原因。在之前的故障排除过程中,我一定是不小心从系统变量 PATH 中删除了必需项,因此它无法再找到 cmd.exe。

pdf 编译器不会在错误消息中说明这一点。另外,TeXLive 安装需要 cmd.exe,自动下载程序虽然也无法工作,但如果使用 GUI 安装,则不会在错误消息中说明这一点。

当我使用文本模式安装时,我意识到了这个错误。将 Windows 二进制文件重新添加到系统变量 PATH 解决了这个问题。

总结: 如果尚未设置,请将“C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem”添加到系统变量 PATH(应为默认设置)。

相关内容