minted 和 LuaLaTeX 的问题

minted 和 LuaLaTeX 的问题

以下文档可以使用和test.tex进行编译,但不能(来自 Windows 上完全更新的 MikTeX 发行版)。pdflatex --shell-escape test.texxelatex --shell-escape test.texlualatex --shell-escape test.tex

\documentclass{article}
\usepackage{minted}

\begin{document}

\begin{minted}{python}
def f(x):
return x**2
\end{minted}

\end{document}

给出的错误是! Package minted Error: Cannot find Pygments style default.

lualatex 版本为 1.15.1。但是,该文档可以在 Ubuntu texlive 中使用 lualatex 进行编译,而 Ubuntu texlive 的 lualatex 版本为 1.14.0。在这个问题与 有关系\write18,但那是 2016 年的,应该由 minted 自动加载 修复shellesc。我不知道是内核更新、lualatex 还是 minted 有问题(或者是我的系统有问题)。任何帮助查找问题的方法都将不胜感激。日志文件如下。

This is LuaHBTeX, Version 1.15.1 (MiKTeX 22.10) (format=lualatex 2022.11.2)  2 NOV 2022 13:07
 system commands enabled.
**test.tex
(./test.tex
LaTeX2e <2022-06-01> patch level 5
Lua module: luaotfload 2022-10-03 3.23 Lua based OpenType font support
Lua module: lualibs 2022-10-04 2.75 ConTeXt Lua standard libraries.
Lua module: lualibs-extended 2022-10-04 2.75 ConTeXt Lua libraries -- extended c
ollection.
luaotfload | conf : Root cache directory is "C:/Users/saint/AppData/Local/MiKTeX
/luatex-cache/generic/names".
luaotfload | init : Loading fontloader "fontloader-2022-10-03.lua" from kpse-res
olved path "C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/luatex/luaotfload/f
ontloader-2022-10-03.lua".
Lua-only attribute luaotfload@noligature = 1
luaotfload | init : Context OpenType loader version 3.120
Inserting `luaotfload.node_processor' at position 1 in `pre_linebreak_filter'.
Inserting `luaotfload.node_processor' at position 1 in `hpack_filter'.
Inserting `luaotfload.glyph_stream' at position 1 in `glyph_stream_provider'.
Inserting `luaotfload.define_font' at position 1 in `define_font'.
Lua-only attribute luaotfload_color_attribute = 2
luaotfload | conf : Root cache directory is "C:/Users/saint/AppData/Local/MiKTeX
/luatex-cache/generic/names".
Inserting `luaotfload.harf.strip_prefix' at position 1 in `find_opentype_file'.
Inserting `luaotfload.harf.strip_prefix' at position 1 in `find_truetype_file'.
Removing  `luaotfload.glyph_stream' from `glyph_stream_provider'.
Inserting `luaotfload.harf.glyphstream' at position 1 in `glyph_stream_provider'
.
Inserting `luaotfload.harf.finalize_vlist' at position 1 in `post_linebreak_filt
er'.
Inserting `luaotfload.harf.finalize_hlist' at position 2 in `hpack_filter'.
Inserting `luaotfload.cleanup_files' at position 1 in `wrapup_run'.
Inserting `luaotfload.harf.finalize_unicode' at position 1 in `finish_pdffile'.
Inserting `luaotfload.glyphinfo' at position 1 in `glyph_info'.
Lua-only attribute luaotfload.letterspace_done = 3
Inserting `luaotfload.aux.set_sscale_dimens' at position 1 in `luaotfload.patch_
font'.
Inserting `luaotfload.aux.set_font_index' at position 2 in `luaotfload.patch_fon
t'.
Inserting `luaotfload.aux.patch_cambria_domh' at position 3 in `luaotfload.patch
_font'.
Inserting `luaotfload.aux.fixup_fontdata' at position 1 in `luaotfload.patch_fon
t_unsafe'.
Inserting `luaotfload.aux.set_capheight' at position 4 in `luaotfload.patch_font
'.
Inserting `luaotfload.aux.set_xheight' at position 5 in `luaotfload.patch_font'.
Inserting `luaotfload.rewrite_fontname' at position 6 in `luaotfload.patch_font'
. L3 programming layer <2022-10-26>
Inserting `tracingstacklevels' at position 1 in `input_level_string'.
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/base/article.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/base/size10.clo
File: size10.clo 2021/10/04 v1.4n Standard LaTeX file (size option)
luaotfload | db : Font names database loaded from C:/Users/saint/AppData/Local/M
iKTeX/luatex-cache/generic/names/luaotfload-names.luc.gz)
\c@part=\count183
\c@section=\count184
\c@subsection=\count185
\c@subsubsection=\count186
\c@paragraph=\count187
\c@subparagraph=\count188
\c@figure=\count189
\c@table=\count190
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen137
)
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/minted/minted.sty
Package: minted 2021/12/24 v2.6 Yet another Pygments shim for LaTeX

(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/graphics/keyval.sty
Package: keyval 2022/05/29 v1.15 key=value parser (DPC)
\KV@toks@=\toks16
)
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/kvoptions/kvoptions.sty
Package: kvoptions 2022-06-15 v3.15 Key value format for package options (HO)
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/generic/ltxcmds/ltxcmds.sty
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
)
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/kvsetkeys/kvsetkeys.sty
Package: kvsetkeys 2022-10-05 v1.19 Key value parser (HO)
)) (C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/fvextra/fvextra.sty
Package: fvextra 2019/02/04 v1.4 fvextra - extensions and patches for fancyvrb

(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/base/ifthen.sty
Package: ifthen 2022/04/13 v1.1d Standard LaTeX ifthen package (DPC)
)
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count191
)
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/fancyvrb/fancyvrb.sty
Package: fancyvrb 2022/06/06 4.5 verbatim text (tvz,hv)
\FV@CodeLineNo=\count192
\FV@InFile=\read2
\FV@TabBox=\box51
\c@FancyVerbLine=\count193
\FV@StepNumber=\count194
\FV@OutFile=\write3
)
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/upquote/upquote.sty
Package: upquote 2012/04/19 v1.3 upright-quote and grave-accent glyphs in verba
tim

(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/base/textcomp.sty
Package: textcomp 2020/02/02 v2.0n Standard LaTeX package
))
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/lineno/lineno.sty
Package: lineno 2005/11/02 line numbers on paragraphs v4.41
\linenopenalty=\count195
\output=\toks17
\linenoprevgraf=\count196
\linenumbersep=\dimen138
\linenumberwidth=\dimen139
\c@linenumber=\count197
\c@pagewiselinenumber=\count198
\c@LN@truepage=\count199
\c@internallinenumber=\count266
\c@internallinenumbers=\count267
\quotelinenumbersep=\dimen140
\bframerule=\dimen141
\bframesep=\dimen142
\bframebox=\box52
LaTeX Info: Redefining \\ on input line 3056.
)
\c@FV@TrueTabGroupLevel=\count268
\c@FV@TrueTabCounter=\count269
\FV@TabBox@Group=\box53
\FV@TmpLength=\skip49
\c@FV@HighlightLinesStart=\count270
\c@FV@HighlightLinesStop=\count271
\FV@LoopCount=\count272
\FV@NCharsBox=\box54
\FV@BreakIndent=\dimen143
\FV@BreakIndentNChars=\count273
\FV@BreakSymbolSepLeft=\dimen144
\FV@BreakSymbolSepLeftNChars=\count274
\FV@BreakSymbolSepRight=\dimen145
\FV@BreakSymbolSepRightNChars=\count275
\FV@BreakSymbolIndentLeft=\dimen146
\FV@BreakSymbolIndentLeftNChars=\count276
\FV@BreakSymbolIndentRight=\dimen147
\FV@BreakSymbolIndentRightNChars=\count277
\c@FancyVerbLineBreakLast=\count278
\FV@LineBox=\box55
\FV@LineIndentBox=\box56
\FV@LineWidth=\dimen148
)
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/tools/calc.sty
Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
\calc@Acount=\count279
\calc@Bcount=\count280
\calc@Adimen=\dimen149
\calc@Bdimen=\dimen150
\calc@Askip=\skip50
\calc@Bskip=\skip51
LaTeX Info: Redefining \setlength on input line 80.
LaTeX Info: Redefining \addtolength on input line 81.
\calc@Ccount=\count281
\calc@Cskip=\skip52
)
(C:/Users/saint/AppData/Local/Programs/MiKTeX/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:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/ifplatform/ifplatform.s
ty
Package: ifplatform 2017/10/13 v0.4a Testing for the operating system

(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/generic/pdftexcmds/pdftexcmds
.sty
Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO
)

(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/generic/infwarerr/infwarerr.s
ty
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
) (C:/Users/saint/AppData/Local/Programs/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.
\pdftexcmds@toks=\toks18
)
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/generic/catchfile/catchfile.s
ty
Package: catchfile 2019/12/09 v1.8 Catch the contents of a file (HO)

(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/generic/etexcmds/etexcmds.sty
Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
)) (C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/generic/iftex/ifluatex.sty
Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.
)) (C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/xstring/xstring.sty
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/generic/xstring/xstring.tex
\integerpart=\count282
\decimalpart=\count283
)
Package: xstring 2021/07/21 v1.84 String manipulations (CT)
) (C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/framed/framed.sty
Package: framed 2011/10/22 v 0.96: framed or shaded text with page breaks
\OuterFrameSep=\skip53
\fb@frw=\dimen151
\fb@frh=\dimen152
\FrameRule=\dimen153
\FrameSep=\dimen154
)
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/float/float.sty
Package: float 2001/11/08 v1.3d Float enhancements (AL)
\c@float@type=\count284
\float@exts=\toks19
\float@box=\box57
\@float@everytoks=\toks20
\@floatcapt=\box58
)
\minted@appexistsfile=\read3
\minted@bgbox=\box59
\minted@code=\write4
\c@minted@FancyVerbLineTemp=\count285
\c@minted@pygmentizecounter=\count286
\@float@every@listing=\toks21
\c@listing=\count287
)
runsystem(if not exist _minted-test mkdir _minted-test)...executed

(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/xcolor/xcolor.sty
Package: xcolor 2022/06/12 v2.14 LaTeX color extensions (UK)

(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/graphics-cfg/color.cfg
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package xcolor Info: Driver file: luatex.def on input line 227.

(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/graphics-def/luatex.def
File: luatex.def 2022/09/22 v1.2d Graphics/color driver for luatex
)
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/graphics/mathcolor.ltx)
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1353.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1357.
Package xcolor Info: Model `RGB' extended on input line 1369.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1371.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1372.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1373.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1374.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1375.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1376.
)
runsystem(for ^%i in (pygmentize.exe pygmentize.bat pygmentize.cmd) do set > tes
t.aex <nul: /p x=^%~$PATH:i>> test.aex)...failed 
runsystem(del test.aex)...executed


! Package minted Error: You must have `pygmentize' installed to use this packag
e.

See the minted package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.4 \begin{document}
                  
? 

(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/l3backend/l3backend-lua
tex.def
File: l3backend-luatex.def 2022-10-26 L3 backend support: PDF output (LuaTeX)
\l__color_backend_stack_int=\count288
\l__pdf_internal_box=\box60
)
No file test.aux.

\openout1 = test.aux
LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 4.
LaTeX Font Info:    Trying to load font information for TS1+cmr on input line 4
.
(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/latex/base/ts1cmr.fd
File: ts1cmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions
)
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for TU/lmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.

(C:/Users/saint/AppData/Local/Programs/MiKTeX/tex/context/base/mkii/supp-pdf.mk
ii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count289
\scratchdimen=\dimen155
\scratchbox=\box61
\nofMPsegments=\count290
\nofMParguments=\count291
\everyMPshowfont=\toks22
\MPscratchCnt=\count292
\MPscratchDim=\dimen156
\MPnumerator=\count293
\makeMPintoPDFobject=\count294
\everyMPtoPDFconversion=\toks23
)
\openout3 = test.pyg

runsystem(pygmentize -S default -f latex -P commandprefix=PYG > _minted-test\def
ault.pygstyle)...failed 
 (./_minted-test/default.pygstyle)
runsystem(pygmentize -S default -f latex -P commandprefix=PYG > _minted-test\def
ault.pygstyle)...failed 
 (./_minted-test/default.pygstyle)

! Package minted Error: Cannot find Pygments style default.

See the minted package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.9 \end{minted}
              
? 
runsystem(pygmentize -l python -f latex -P commandprefix=PYG -F tokenmerge -P st
ripnl=False -o _minted-test/189EEE06CBA6C86622D59B8F650FBEB15337DF326E54B7D240B7
6C5FB32DA588.pygtex test.pyg)...failed 

! 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.9 \end{minted}
              
? 
(./test.aux)
runsystem(del test.pyg)...executed
)

Here is how much of LuaTeX's memory you used:
 5472 strings out of 477345
 100000,552014 words of node,token memory allocated
 426 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 6 attribute, 49 glue_spec,
 6 attribute_list, 2 write, 1 pdf_colorstack nodes
   avail lists: 2:11,3:1,4:1,5:4,7:1,9:1
 26391 multiletter control sequences out of 65536+600000
 15 fonts using 723367 bytes
 75i,1n,77p,249b,121s stack positions out of 10000i,1000n,20000p,200000b,80000s

warning  (pdf backend): no pages of output.

PDF statistics: 0 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 131072)
 1 words of extra memory for PDF output out of 10000 (max. 100000000)

答案1

我也能重现该问题。

全新安装 MiKTeX、Python 3.11(已添加到路径并可从 shell 中使用。

尝试使用 TeXMaker 和 TeXStudio,也是全新安装的。

它与 pdflatex 和 Xelatex 兼容。

作为一种解决方法,我使用带有 -lualatex 选项的 latexmk,并且它可以工作。

相关内容