无法使用 TeXStudio 编译 Minted 环境
Posted
技术标签:
【中文标题】无法使用 TeXStudio 编译 Minted 环境【英文标题】:Cannot compile Minted environment with TeXStudio 【发布时间】:2019-10-21 12:43:17 【问题描述】:我正在写一个 Latex 文档,并希望有一些代码突出显示。所以我决定使用 minted 包。但我不能让最小的例子起作用。
Pygments 包通过 anaconda 安装在路径 /anaconda3/lib/python3.7/site-packages 下。从 CLI 运行 pygmentize -V 有效。
我正在使用 TexStudio,并且还在命令中包含了“-shell-escape”。
但无论如何我都会收到以下错误
line 94: Paragraph ended before \zap@space was complete....\edef\@tempa\expandafter\zap@space\@tempa
line 104: Paragraph ended before \ip@only@six was complete. ...ef\@tempc\expandafter\ip@only@six\@tempa
line 104: Undefined control sequence. ...expandafter\ip@only@six\@tempa------\@nil
line 5: Package minted Error: You must have `pygmentize' installed to use this package. \begindocument
line 11: Package minted Error: Missing Pygments output; \inputminted wasor may be using frozencache with a missing file. \endminted^^M
line 11: Package minted Error: Missing Pygments output; \inputminted wasor may be using frozencache with a missing file. \endminted^^M
line 11: Package minted Error: Missing Pygments output; \inputminted wasor may be using frozencache with a missing file. \endminted
例子:
\documentclassarticle
\usepackageminted
\begindocument
\beginmintedc
int main()
printf("hello, world");
return 0;
\endminted
\enddocument
操作系统是 macOS Mojave。
谁能告诉我发生了什么事?
更新:根据 cmets 的要求,这是完整的日志
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex 2019.10.21) 21 OCT 2019 16:34
entering extended mode
\write18 enabled.
%&-line parsing enabled.
**PraxisphaseAufsatz.tex
(./PraxisphaseAufsatz.tex
LaTeX2e <2019-10-01> patch level 1
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/08/27 v1.4j Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2019/08/27 v1.4j Standard LaTeX file (size option)
)
\c@part=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/minted/minted.sty
Package: minted 2017/07/19 v2.5 Yet another Pygments shim for LaTeX
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/kvoptions.sty
Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/ltxcmds.sty
Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/infwarerr.sty
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/etexcmds.sty
Package: etexcmds 2016/05/16 v1.6 Avoid name ***es with e-TeX commands (HO)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/ifluatex.sty
Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
))))
(/usr/local/texlive/2019/texmf-dist/tex/latex/fvextra/fvextra.sty
Package: fvextra 2019/02/04 v1.4 fvextra - extensions and patches for fancyvrb
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ifthen.sty
Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2019/09/21 v2.5h e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count88
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Package: fancyvrb 2019/01/15
Style option: `fancyvrb' v3.2a <2019/01/15> (tvz)
\FV@CodeLineNo=\count89
\FV@InFile=\read1
\FV@TabBox=\box27
\c@FancyVerbLine=\count90
\FV@StepNumber=\count91
\FV@OutFile=\write3
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/upquote/upquote.sty
Package: upquote 2012/04/19 v1.3 upright-quote and grave-accent glyphs in verba
tim
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/lineno/lineno.sty
Package: lineno 2005/11/02 line numbers on paragraphs v4.41
\linenopenalty=\count92
\output=\toks15
\linenoprevgraf=\count93
\linenumbersep=\dimen103
\linenumberwidth=\dimen104
\c@linenumber=\count94
\c@pagewiselinenumber=\count95
\c@LN@truepage=\count96
\c@internallinenumber=\count97
\c@internallinenumbers=\count98
\quotelinenumbersep=\dimen105
\bframerule=\dimen106
\bframesep=\dimen107
\bframebox=\box28
LaTeX Info: Redefining \\ on input line 3056.
)
\c@FV@TrueTabGroupLevel=\count99
\c@FV@TrueTabCounter=\count100
\FV@TabBox@Group=\box29
\FV@TmpLength=\skip43
\c@FV@HighlightLinesStart=\count101
\c@FV@HighlightLinesStop=\count102
\FV@LoopCount=\count103
\FV@NCharsBox=\box30
\FV@BreakIndent=\dimen108
\FV@BreakIndentNChars=\count104
\FV@BreakSymbolSepLeft=\dimen109
\FV@BreakSymbolSepLeftNChars=\count105
\FV@BreakSymbolSepRight=\dimen110
\FV@BreakSymbolSepRightNChars=\count106
\FV@BreakSymbolIndentLeft=\dimen111
\FV@BreakSymbolIndentLeftNChars=\count107
\FV@BreakSymbolIndentRight=\dimen112
\FV@BreakSymbolIndentRightNChars=\count108
\c@FancyVerbLineBreakLast=\count109
\FV@LineBox=\box31
\FV@LineIndentBox=\box32
\FV@LineWidth=\dimen113
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/tools/calc.sty
Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
\calc@Acount=\count110
\calc@Bcount=\count111
\calc@Adimen=\dimen114
\calc@Bdimen=\dimen115
\calc@Askip=\skip44
\calc@Bskip=\skip45
LaTeX Info: Redefining \setlength on input line 80.
LaTeX Info: Redefining \addtolength on input line 81.
\calc@Ccount=\count112
\calc@Cskip=\skip46
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/tools/shellesc.sty
Package: shellesc 2016/06/07 v0.02b unified shell escape interface for LaTeX
Package shellesc Info: Unrestricted shell escape enabled on input line 70.
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/ifplatform/ifplatform.sty
Package: ifplatform 2017/10/13 v0.4a Testing for the operating system
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
Package: pdftexcmds 2019/07/25 v0.30 Utility functions of pdfTeX for LuaTeX (HO
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/ifpdf.sty
Package: ifpdf 2018/09/07 v3.3 Provides the ifpdf switch
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/catchfile.sty
Package: catchfile 2016/05/16 v1.7 Catch the contents of a file (HO)
)
runsystem(uname -s > "PraxisphaseAufsatz.w18")...executed.
(./PraxisphaseAufsatz.w18)
runsystem(rm -- "PraxisphaseAufsatz.w18")...executed.
Runaway argument?
! Paragraph ended before \zap@space was complete.
<to be read again>
\par
l.94 ...\edef\@tempa\expandafter\zap@space\@tempa
\@empty
I suspect you've forgotten a `', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
Runaway argument?
! Paragraph ended before \ip@only@six was complete.
<to be read again>
\par
l.104 ...ef\@tempc\expandafter\ip@only@six\@tempa
------\@nil
I suspect you've forgotten a `', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Undefined control sequence.
l.104 ...expandafter\ip@only@six\@tempa------\@nil
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
) (/usr/local/texlive/2019/texmf-dist/tex/generic/xstring/xstring.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/xstring/xstring.tex
\integerpart=\count113
\decimalpart=\count114
)
Package: xstring 2019/02/06 v1.83 String manipulations (CT)
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/framed/framed.sty
Package: framed 2011/10/22 v 0.96: framed or shaded text with page breaks
\OuterFrameSep=\skip47
\fb@frw=\dimen116
\fb@frh=\dimen117
\FrameRule=\dimen118
\FrameSep=\dimen119
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/float/float.sty
Package: float 2001/11/08 v1.3d Float enhancements (AL)
\c@float@type=\count115
\float@exts=\toks16
\float@box=\box33
\@float@everytoks=\toks17
\@floatcapt=\box34
)
\minted@appexistsfile=\read2
\minted@bgbox=\box35
\minted@code=\write4
\c@minted@FancyVerbLineTemp=\count116
\c@minted@pygmentizecounter=\count117
\@float@every@listing=\toks18
\c@listing=\count118
)
runsystem(mkdir -p _minted-PraxisphaseAufsatz)...executed.
(/usr/local/texlive/2019/texmf-dist/tex/latex/xcolor/xcolor.sty
Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK)
(/usr/local/texlive/2019/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 225.
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-def/pdftex.def
File: pdftex.def 2018/01/08 v1.0l 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.
)
runsystem(which pygmentize && touch PraxisphaseAufsatz.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.5 \begindocument
Refer to the installation instructions in the minted documentation for more inf
ormation.
(./PraxisphaseAufsatz.aux)
\openout1 = `PraxisphaseAufsatz.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 T1/cmr/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 OMS/cmsy/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.
(/usr/local/texlive/2019/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count119
\scratchdimen=\dimen120
\scratchbox=\box36
\nofMPsegments=\count120
\nofMParguments=\count121
\everyMPshowfont=\toks19
\MPscratchCnt=\count122
\MPscratchDim=\dimen121
\MPnumerator=\count123
\makeMPintoPDFobject=\count124
\everyMPtoPDFconversion=\toks20
)
\openout3 = `PraxisphaseAufsatz.pyg'.
runsystem(pygmentize -S default -f latex -P commandprefix=PYG > _minted-Praxisp
haseAufsatz/default-pyg-prefix.pygstyle)...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 \endminted^^M
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.
runsystem(pygmentize -S default -f latex -P commandprefix=PYGdefault > _minted-
PraxisphaseAufsatz/default.pygstyle)...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 \endminted^^M
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.
runsystem(pygmentize -l c -f latex -P commandprefix=PYG -F tokenmerge -o _minte
d-PraxisphaseAufsatz/916909323916480C99F1AA97E621BB15219288A92FD0AFDEBD8CE6CF1E
55BAC6.pygtex PraxisphaseAufsatz.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 \endminted
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.
(./PraxisphaseAufsatz.aux)
runsystem(rm PraxisphaseAufsatz.pyg)...executed.
runsystem(rm PraxisphaseAufsatz.out.pyg)...executed.
)
Here is how much of TeX's memory you used:
4533 strings out of 492167
82218 string characters out of 6125388
193966 words of memory out of 5000000
8870 multiletter control sequences out of 15000+600000
3640 words of font info for 14 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
42i,1n,37p,833b,142s stack positions out of 5000i,500n,10000p,200000b,80000s
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)
【问题讨论】:
你能显示完整的.log文件吗? 感谢您的日志文件!您可以尝试使用tlmgr update -self -all
更新您的tex 发行版吗?有些包不是最新的,可能是这个问题
嗨,我更新了发行版,但这似乎并没有解决这个问题。将在一分钟内更新日志文件
太棒了!下一个测试:CLI 中的pdflatex -shell-escape filename
是否有效?
如果文档是从 CLI 编译的,请检查 python 是否在您的 texstudio 路径中,例如i.stack.imgur.com/AJnb9.png 但使用你的 anaconda 路径
【参考方案1】:
如果 anaconda python 二进制文件尚未在所有应用程序的搜索路径中,可以通过Preferences->Build->Commands ($PATH)
将其添加到 texstudio 搜索路径中
如果这个python版本应该适用于所有应用程序,也可以全局添加到路径中,见https://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications(这可能会导致应用程序自带python版本)
【讨论】:
知道 Windows 上的等价物是什么吗? @Colin 不知道,对不起! 嗨 @Colin 将 C:\Users\*your_username*\\Anaconda3\Scripts 添加到对我有用的构建命令路径以上是关于无法使用 TeXStudio 编译 Minted 环境的主要内容,如果未能解决你的问题,请参考以下文章
Ubuntu18 下 TeXstudio 编译不了含有 .eps 格式的图片