我想使用 minted 包将 Julia 代码嵌入 LaTeX。我的电脑运行的是 Windows 10,本地安装了 MiKTex 并使用 TexStudio。我确实安装了 pygments.py 2.8.1,在 MiKTeX 中更新了 minted.sty 包,并尝试通过两种方式(使用 PdfLatex 和 LuaLaTex 编译器)解决“–-shell escape flag”的问题:
(i)在TexStudio的配置中:
pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex
(二)并用行首的“magic”注释:
%!TeX TXS-program:compile = txs:///pdflatex/[–shell-escape]
错误一直重复出现:
Package minted Error: Missing Pygments output; \inputminted wasor may be using frozencache with a missing file. \end{minted}
我做错了什么?我查看了许多 Stack 论坛,但没有找到其他替代方案。我查看了 minted 软件包文档,发现它需要另一个软件包:shellesc.sty,显然出于安全原因,它不再是 MiKTeX 发行版的一部分(实际上,它说它还需要 ifthen.sty,但 MiKTeX 中也没有,我发现安装了“ifthenx.sty”和“xifthen.sty”,但没有安装“ifthen.sty”)。这是导致 minted 提供的最基本示例无法在我的计算机上运行的根本原因吗?
梅威瑟:
\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{c}
int main() {
printf("hello, world");
return 0;
}
\end{minted}
\end{document}
输出如下
我的 LaTeX 代码是这样的(带有 --shell 转义标志的神奇注释):
%!TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]
\documentclass{article}
\usepackage{xcolor}
\usepackage{minted}
\begin{document}
\begin{minted}{c}
int main() {
printf("hello, world");
return 0;
}
\end{minted}
\end{document}
日志如下:
This is pdfTeX, Version 3.141592653-2.6-1.40.22 (MiKTeX 21.3) (preloaded format=pdflatex 2021.3.18) 19 MAR 2021 18:59
entering extended mode
**./Minted_Experience_3.tex
(Minted_Experience_3.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-18>
(C:\Program Files\MiKTeX 2.9\tex/latex/base\article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(C:\Program Files\MiKTeX 2.9\tex/latex/base\size10.clo
File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option)
)
\c@part=\count179
\c@section=\count180
\c@subsection=\count181
\c@subsubsection=\count182
\c@paragraph=\count183
\c@subparagraph=\count184
\c@figure=\count185
\c@table=\count186
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
)
(C:\Program Files\MiKTeX 2.9\tex/latex/xcolor\xcolor.sty
Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK)
(C:\Program Files\MiKTeX 2.9\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 225.
(C:\Program Files\MiKTeX 2.9\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 1348.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352.
Package xcolor Info: Model `RGB' extended on input line 1364.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371.
) (minted.sty
Package: minted 2017/09/03 v2.5.1dev Yet another Pygments shim for LaTeX
(C:\Program Files\MiKTeX 2.9\tex/latex/graphics\keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks15
)
(C:\Program Files\MiKTeX 2.9\tex/latex/kvoptions\kvoptions.sty
Package: kvoptions 2020-10-07 v3.14 Key value format for package options (HO)
(C:\Program Files\MiKTeX 2.9\tex/generic/ltxcmds\ltxcmds.sty
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
)
(C:\Program Files\MiKTeX 2.9\tex/generic/kvsetkeys\kvsetkeys.sty
Package: kvsetkeys 2019/12/15 v1.18 Key value parser (HO)
))
(C:\Program Files\MiKTeX 2.9\tex/latex/fvextra\fvextra.sty
Package: fvextra 2019/02/04 v1.4 fvextra - extensions and patches for fancyvrb
(C:\Program Files\MiKTeX 2.9\tex/latex/base\ifthen.sty
Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
)
(C:\Program Files\MiKTeX 2.9\tex/latex/etoolbox\etoolbox.sty
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count187
)
(C:\Program Files\MiKTeX 2.9\tex/latex/fancyvrb\fancyvrb.sty
Package: fancyvrb 2021/01/20 v3.7 verbatim text (tvz,hv)
\FV@CodeLineNo=\count188
\FV@InFile=\read2
\FV@TabBox=\box47
\c@FancyVerbLine=\count189
\FV@StepNumber=\count190
\FV@OutFile=\write3
)
(C:\Program Files\MiKTeX 2.9\tex/latex/upquote\upquote.sty
Package: upquote 2012/04/19 v1.3 upright-quote and grave-accent glyphs in verba
tim
)
(C:\Program Files\MiKTeX 2.9\tex/latex/lineno\lineno.sty
Package: lineno 2005/11/02 line numbers on paragraphs v4.41
\linenopenalty=\count191
\output=\toks16
\linenoprevgraf=\count192
\linenumbersep=\dimen139
\linenumberwidth=\dimen140
\c@linenumber=\count193
\c@pagewiselinenumber=\count194
\c@LN@truepage=\count195
\c@internallinenumber=\count196
\c@internallinenumbers=\count197
\quotelinenumbersep=\dimen141
\bframerule=\dimen142
\bframesep=\dimen143
\bframebox=\box48
LaTeX Info: Redefining \\ on input line 3056.
)
\c@FV@TrueTabGroupLevel=\count198
\c@FV@TrueTabCounter=\count199
\FV@TabBox@Group=\box49
\FV@TmpLength=\skip49
\c@FV@HighlightLinesStart=\count266
\c@FV@HighlightLinesStop=\count267
\FV@LoopCount=\count268
\FV@NCharsBox=\box50
\FV@BreakIndent=\dimen144
\FV@BreakIndentNChars=\count269
\FV@BreakSymbolSepLeft=\dimen145
\FV@BreakSymbolSepLeftNChars=\count270
\FV@BreakSymbolSepRight=\dimen146
\FV@BreakSymbolSepRightNChars=\count271
\FV@BreakSymbolIndentLeft=\dimen147
\FV@BreakSymbolIndentLeftNChars=\count272
\FV@BreakSymbolIndentRight=\dimen148
\FV@BreakSymbolIndentRightNChars=\count273
\c@FancyVerbLineBreakLast=\count274
\FV@LineBox=\box51
\FV@LineIndentBox=\box52
\FV@LineWidth=\dimen149
)
(C:\Program Files\MiKTeX 2.9\tex/latex/latex-tools\calc.sty
Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
\calc@Acount=\count275
\calc@Bcount=\count276
\calc@Adimen=\dimen150
\calc@Bdimen=\dimen151
\calc@Askip=\skip50
\calc@Bskip=\skip51
LaTeX Info: Redefining \setlength on input line 80.
LaTeX Info: Redefining \addtolength on input line 81.
\calc@Ccount=\count277
\calc@Cskip=\skip52
)
(C:\Program Files\MiKTeX 2.9\tex/latex/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:\Program Files\MiKTeX 2.9\tex/latex/ifplatform\ifplatform.sty
Package: ifplatform 2017/10/13 v0.4a Testing for the operating system
(C:\Program Files\MiKTeX 2.9\tex/generic/pdftexcmds\pdftexcmds.sty
Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO
)
(C:\Program Files\MiKTeX 2.9\tex/generic/infwarerr\infwarerr.sty
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
)
(C:\Program Files\MiKTeX 2.9\tex/generic/iftex\iftex.sty
Package: iftex 2020/03/06 v1.0d TeX engine tests
)
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
)
(C:\Program Files\MiKTeX 2.9\tex/generic/catchfile\catchfile.sty
Package: catchfile 2019/12/09 v1.8 Catch the contents of a file (HO)
(C:\Program Files\MiKTeX 2.9\tex/generic/etexcmds\etexcmds.sty
Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
))
(C:\Program Files\MiKTeX 2.9\tex/generic/iftex\ifluatex.sty
Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.
))
(C:\Program Files\MiKTeX 2.9\tex/latex/xstring\xstring.sty
(C:\Program Files\MiKTeX 2.9\tex/generic/xstring\xstring.tex
\integerpart=\count278
\decimalpart=\count279
)
Package: xstring 2019/02/06 v1.83 String manipulations (CT)
)
(C:\Program Files\MiKTeX 2.9\tex/latex/framed\framed.sty
Package: framed 2011/10/22 v 0.96: framed or shaded text with page breaks
\OuterFrameSep=\skip53
\fb@frw=\dimen152
\fb@frh=\dimen153
\FrameRule=\dimen154
\FrameSep=\dimen155
)
(C:\Program Files\MiKTeX 2.9\tex/latex/float\float.sty
Package: float 2001/11/08 v1.3d Float enhancements (AL)
\c@float@type=\count280
\float@exts=\toks17
\float@box=\box53
\@float@everytoks=\toks18
\@floatcapt=\box54
)
\minted@appexistsfile=\read3
\minted@bgbox=\box55
\minted@code=\write4
\c@minted@FancyVerbLineTemp=\count281
\c@minted@pygmentizecounter=\count282
\@float@every@listing=\toks19
\c@listing=\count283
)
runsystem(if not exist _minted-Minted_Experience_3 mkdir _minted-Minted_Experie
nce_3)...executed.
runsystem(for ^%i in (pygmentize.exe pygmentize.bat pygmentize.cmd) do set > Mi
nted_Experience_3.aex <nul: /p x=^%~$PATH:i>> Minted_Experience_3.aex)...execut
ed.
runsystem(del Minted_Experience_3.aex)...executed.
(C:\Program Files\MiKTeX 2.9\tex/latex/l3backend\l3backend-pdftex.def
File: l3backend-pdftex.def 2021-03-02 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count284
\l__pdf_internal_box=\box56
)
(Minted_Experience_3.aux)
\openout1 = `Minted_Experience_3.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 5.
LaTeX Font Info: ... okay on input line 5.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 5.
LaTeX Font Info: ... okay on input line 5.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 5.
LaTeX Font Info: ... okay on input line 5.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 5.
LaTeX Font Info: ... okay on input line 5.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 5.
LaTeX Font Info: ... okay on input line 5.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 5.
LaTeX Font Info: ... okay on input line 5.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 5.
LaTeX Font Info: ... okay on input line 5.
(C:\Program Files\MiKTeX 2.9\tex/context/base/mkii\supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count285
\scratchdimen=\dimen156
\scratchbox=\box57
\nofMPsegments=\count286
\nofMParguments=\count287
\everyMPshowfont=\toks20
\MPscratchCnt=\count288
\MPscratchDim=\dimen157
\MPnumerator=\count289
\makeMPintoPDFobject=\count290
\everyMPtoPDFconversion=\toks21
)
\openout3 = `Minted_Experience_3.pyg'.
(_minted-Minted_Experience_3/default-pyg-prefix.pygstyle)
(_minted-Minted_Experience_3/default.pygstyle)
runsystem(pygmentize -l c -f latex -P commandprefix=PYG -F tokenmerge -o _minte
d-Minted_Experience_3/916909323916480C99F1AA97E621BB15C4F7931A617C79475C856E513
2212F69.pygtex Minted_Experience_3.pyg)...executed.
! Package minted Error: Missing Pygments output; \inputminted was
probably given a file that does not exist--otherwise, you may need
the outputdir package option, or may be using an incompatible build tool,
or may be using frozencache with a missing file.
See the minted package documentation for explanation.
Type H <return> for immediate help.
...
l.11 \end{minted}
This could be caused by using -output-directory or -aux-directory
without setting minted's outputdir, or by using a build tool that
changes paths in ways minted cannot detect,
or using frozencache with a missing file.
(Minted_Experience_3.aux)
runsystem(del Minted_Experience_3.pyg)...executed.
)
Here is how much of TeX's memory you used:
4810 strings out of 479291
88815 string characters out of 2863489
423495 words of memory out of 3000000
22250 multiletter control sequences out of 15000+200000
403430 words of font info for 27 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
85i,1n,88p,284b,142s stack positions out of 5000i,500n,10000p,200000b,50000s
No pages of output.
PDF statistics:
0 PDF objects out of 1000 (max. 8388607)
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)