![铸造包:未定义的控制序列](https://linux22.com/image/253528/%E9%93%B8%E9%80%A0%E5%8C%85%EF%BC%9A%E6%9C%AA%E5%AE%9A%E4%B9%89%E7%9A%84%E6%8E%A7%E5%88%B6%E5%BA%8F%E5%88%97.png)
我刚刚安装了 minted 包,以便在我的大学报告中输入更漂亮的代码,我正在尝试,但在编译时我一直收到相同的消息:
这是来源:
\documentclass{report}
\usepackage{minted}
\begin{document}
\begin{minted}{c}
int i,j,k,n;
\end{minted}
\end{document}
我使用以下命令进行编译:
pdflatex --shell-escape source.tex
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
\write18 enabled.
entering extended mode
(./source.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, spanish, galician, catalan, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo)) (./minted.sty
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-texlive/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix
<2008/02/07> (tvz)) (/usr/share/texmf/tex/latex/xcolor/xcolor.sty
(/etc/texmf/tex/latex/config/color.cfg)
(/usr/share/texmf-texlive/tex/latex/pdftex-def/pdftex.def))
(/usr/share/texmf-texlive/tex/latex/float/float.sty)
(/usr/share/texmf-texlive/tex/latex/base/ifthen.sty)
(/usr/share/texmf-texlive/tex/latex/tools/calc.sty) (./ifplatform.sty))
! Undefined control sequence.
\minted.sty-h@@k ...elax \ifnum \pdf@shellescape
=1\relax \else \PackageErr...
l.3
? ! Missing number, treated as zero.
<to be read again>
=
l.3
?
! Package minted Error: You must invoke LaTeX with the -shell-escape flag.
See the minted package documentation for explanation.
Type H <return> for immediate help.
...
l.3
? /usr/bin/pygmentize
(./source.aux) (/usr/share/texmf-texlive/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (./source.pyg) (./source.out.pyg) [1{/var/lib/texmf/fonts/map/pdftex/updmap/p
dftex.map}] (./source.aux) )</usr/share/texmf-texlive/fonts/type1/public/amsfon
ts/cm/cmr10.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmtt10
.pfb>
Output written on source.pdf (1 page, 18733 bytes).
Transcript written on source.log.
输出看起来符合预期,但是为什么会出现所有这些消息?
答案1
如果 TeX 编译器支持该功能的状态查询,则命令在包(捆绑包的一部分)\pdf@shellescape
中定义。pdftexcmds
oberdiek
write18/shell escape
因此只需\usepackage{pdftexcmds}
在 之前添加\usepackage{minted}
。