这个问题在这里被问到并回答被淘汰\begin{minted}{...}
但\inputminted
还好。据说这个问题在 fancyvrb 4.1 中已经得到解决,但我安装了完整的 TextLive+Texmaker(fancyvrb 4.1b),问题仍然存在。铸造的部分没有显示在 PDF 中。重现方法:
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{minted}
\begin{document}
ABCDE
\begin{minted}{python}
def __init__(self, x, y):
self.x=x
self.y=y
\end{minted}
FGHIJ
\end{document}
overleaf.com 上的输出(预期输出):
使用 TexLive + Texmake (fancyvrb 4.1b) 的输出:
日志文件:
This is pdfTeX, Version 3.141592653-2.6-1.40.23 (TeX Live 2021/W32TeX) (preloaded format=pdflatex 2022.2.5) 7 FEB 2022 09:55
entering extended mode
\write18 enabled.
%&-line parsing enabled.
**minted.tex
(./minted.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-01-21>
(c:/texlive/2021/texmf-dist/tex/latex/base/article.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(c:/texlive/2021/texmf-dist/tex/latex/base/size12.clo
File: size12.clo 2021/10/04 v1.4n Standard LaTeX file (size option)
)
\c@part=\count185
\c@section=\count186
\c@subsection=\count187
\c@subsubsection=\count188
\c@paragraph=\count189
\c@subparagraph=\count190
\c@figure=\count191
\c@table=\count192
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
)
(c:/texlive/2021/texmf-dist/tex/latex/base/fontenc.sty
Package: fontenc 2021/04/29 v2.0v Standard LaTeX package
)
(c:/texlive/2021/texmf-dist/tex/latex/minted/minted.sty
Package: minted 2021/12/24 v2.6 Yet another Pygments shim for LaTeX
(c:/texlive/2021/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks16
)
(c:/texlive/2021/texmf-dist/tex/latex/kvoptions/kvoptions.sty
Package: kvoptions 2020-10-07 v3.14 Key value format for package options (HO)
(c:/texlive/2021/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
)
(c:/texlive/2021/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty
Package: kvsetkeys 2019/12/15 v1.18 Key value parser (HO)
))
(c:/texlive/2021/texmf-dist/tex/latex/fvextra/fvextra.sty
Package: fvextra 2019/02/04 v1.4 fvextra - extensions and patches for fancyvrb
(c:/texlive/2021/texmf-dist/tex/latex/base/ifthen.sty
Package: ifthen 2020/11/24 v1.1c Standard LaTeX ifthen package (DPC)
)
(c:/texlive/2021/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count193
)
(c:/texlive/2021/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Package: fancyvrb 2021/12/21 4.1b verbatim text (tvz,hv)
\FV@CodeLineNo=\count194
\FV@InFile=\read2
\FV@TabBox=\box50
\c@FancyVerbLine=\count195
\FV@StepNumber=\count196
\FV@OutFile=\write3
)
(c:/texlive/2021/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/2021/texmf-dist/tex/latex/base/textcomp.sty
Package: textcomp 2020/02/02 v2.0n Standard LaTeX package
))
(c:/texlive/2021/texmf-dist/tex/latex/lineno/lineno.sty
Package: lineno 2005/11/02 line numbers on paragraphs v4.41
\linenopenalty=\count197
\output=\toks17
\linenoprevgraf=\count198
\linenumbersep=\dimen139
\linenumberwidth=\dimen140
\c@linenumber=\count199
\c@pagewiselinenumber=\count266
\c@LN@truepage=\count267
\c@internallinenumber=\count268
\c@internallinenumbers=\count269
\quotelinenumbersep=\dimen141
\bframerule=\dimen142
\bframesep=\dimen143
\bframebox=\box51
LaTeX Info: Redefining \\ on input line 3056.
)
\c@FV@TrueTabGroupLevel=\count270
\c@FV@TrueTabCounter=\count271
\FV@TabBox@Group=\box52
\FV@TmpLength=\skip49
\c@FV@HighlightLinesStart=\count272
\c@FV@HighlightLinesStop=\count273
\FV@LoopCount=\count274
\FV@NCharsBox=\box53
\FV@BreakIndent=\dimen144
\FV@BreakIndentNChars=\count275
\FV@BreakSymbolSepLeft=\dimen145
\FV@BreakSymbolSepLeftNChars=\count276
\FV@BreakSymbolSepRight=\dimen146
\FV@BreakSymbolSepRightNChars=\count277
\FV@BreakSymbolIndentLeft=\dimen147
\FV@BreakSymbolIndentLeftNChars=\count278
\FV@BreakSymbolIndentRight=\dimen148
\FV@BreakSymbolIndentRightNChars=\count279
\c@FancyVerbLineBreakLast=\count280
\FV@LineBox=\box54
\FV@LineIndentBox=\box55
\FV@LineWidth=\dimen149
)
(c:/texlive/2021/texmf-dist/tex/latex/tools/calc.sty
Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
\calc@Acount=\count281
\calc@Bcount=\count282
\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=\count283
\calc@Cskip=\skip52
)
(c:/texlive/2021/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/2021/texmf-dist/tex/latex/ifplatform/ifplatform.sty
Package: ifplatform 2017/10/13 v0.4a Testing for the operating system
(c:/texlive/2021/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO
)
(c:/texlive/2021/texmf-dist/tex/generic/infwarerr/infwarerr.sty
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
)
(c:/texlive/2021/texmf-dist/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:/texlive/2021/texmf-dist/tex/generic/catchfile/catchfile.sty
Package: catchfile 2019/12/09 v1.8 Catch the contents of a file (HO)
(c:/texlive/2021/texmf-dist/tex/generic/etexcmds/etexcmds.sty
Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
))
(c:/texlive/2021/texmf-dist/tex/generic/iftex/ifluatex.sty
Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.
))
(c:/texlive/2021/texmf-dist/tex/generic/xstring/xstring.sty
(c:/texlive/2021/texmf-dist/tex/generic/xstring/xstring.tex
\integerpart=\count284
\decimalpart=\count285
)
Package: xstring 2021/07/21 v1.84 String manipulations (CT)
)
(c:/texlive/2021/texmf-dist/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:/texlive/2021/texmf-dist/tex/latex/float/float.sty
Package: float 2001/11/08 v1.3d Float enhancements (AL)
\c@float@type=\count286
\float@exts=\toks18
\float@box=\box56
\@float@everytoks=\toks19
\@floatcapt=\box57
)
\minted@appexistsfile=\read3
\minted@bgbox=\box58
\minted@code=\write4
\c@minted@FancyVerbLineTemp=\count287
\c@minted@pygmentizecounter=\count288
\@float@every@listing=\toks20
\c@listing=\count289
)
runsystem(if not exist _minted-minted mkdir _minted-minted)...executed.
(c:/texlive/2021/texmf-dist/tex/latex/xcolor/xcolor.sty
Package: xcolor 2021/10/31 v2.13 LaTeX color extensions (UK)
(c:/texlive/2021/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/2021/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 > mi
nted.aex <nul: /p x=^%~$PATH:i>> minted.aex)...executed.
runsystem(del minted.aex)...executed.
(c:/texlive/2021/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def
File: l3backend-pdftex.def 2022-01-12 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count290
\l__pdf_internal_box=\box59
)
No file minted.aux.
\openout1 = `minted.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: ... 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:/texlive/2021/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count291
\scratchdimen=\dimen156
\scratchbox=\box60
\nofMPsegments=\count292
\nofMParguments=\count293
\everyMPshowfont=\toks21
\MPscratchCnt=\count294
\MPscratchDim=\dimen157
\MPnumerator=\count295
\makeMPintoPDFobject=\count296
\everyMPtoPDFconversion=\toks22
)
\openout3 = `minted.pyg'.
runsystem(pygmentize -S default -f latex -P commandprefix=PYG > _minted-minted\
default.pygstyle)...executed.
(./_minted-minted/default.pygstyle)
runsystem(pygmentize -l python -f latex -P commandprefix=PYG -F tokenmerge -P s
tripnl=False -o _minted-minted/D516F06DB10641AFE59AD0303A4F34978AB6F1E49C02A0FC
BA80F37EE07386BC.pygtex minted.pyg)...executed.
(./_minted-minted/D516F06DB10641AFE59AD0303A4F34978AB6F1E49C02A0FCBA80F37EE0738
6BC.pygtex) [1
{c:/texlive/2021/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(build/minted.aux)
runsystem(del minted.pyg)...executed.
)
Here is how much of TeX's memory you used:
5476 strings out of 478287
102472 string characters out of 5850750
430476 words of memory out of 5000000
23629 multiletter control sequences out of 15000+600000
470321 words of font info for 30 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
75i,5n,81p,268b,201s stack positions out of 5000i,500n,10000p,200000b,80000s
{c:/texlive/2021/texmf-dist/fonts/enc/dvips/cm-super/cm-super-t1.enc}<c:/texl
ive/2021/texmf-dist/fonts/type1/public/cm-super/sfrm1200.pfb>
Output written on build/minted.pdf (1 page, 6990 bytes).
PDF statistics:
14 PDF objects out of 1000 (max. 8388607)
8 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
答案1
尝试了一些选项(参见评论,感谢@David)但没有成功后,通过卸载 TexMaker、TexLive 并全新安装解决了问题。