我想使用 minted 来突出显示我的 LATEX 文档中的语法。但它似乎不起作用。
我通过 MiKTeX 安装了 minted,并将 pygments 添加到我的 python 安装中。所有内容都正确地添加到路径变量中:我可以从 cmd 启动python
并pygmentize -L lexers
获得正确的输出。
我尝试了 Minted 手册中的示例:
\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{c}
int main() {
printf("hello, world");
return 0;
}
\end{minted}
\end{document}
使用命令:
pdflatex -shell-escape minimal
并给出如下输出:
C:\Users\User\Desktop\New folder>pdflatex -shell-escape minimal
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9)
entering extended mode
(minimal.tex
LaTeX2e <2016/03/31> patch level 1
Babel <3.9r> and hyphenation patterns for 75 language(s) loaded.
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\base\article.cl
s"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\base\size10.clo
"))
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\minted\minted.s
ty"
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\graphics\keyval
.sty")
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\oberdiek\kvopti
ons.sty"
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\generic\oberdiek\ltxc
mds.sty")
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\generic\oberdiek\kvse
tkeys.sty"
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\generic\oberdiek\infw
arerr.sty")
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\generic\oberdiek\etex
cmds.sty"
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\generic\oberdiek\iflu
atex.sty"))))
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\fvextra\fvextra
.sty"
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\base\ifthen.sty
")
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\etoolbox\etoolb
ox.sty")
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\fancyvrb\fancyv
rb.sty"
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix
<2008/02/07> (tvz))
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\upquote\upquote
.sty")
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\lineno\lineno.s
ty"))
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\float\float.sty
")
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\tools\calc.sty"
)
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\tools\shellesc.
sty")
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\ifplatform\ifpl
atform.sty"
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\generic\oberdiek\pdft
excmds.sty"
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\generic\oberdiek\ifpd
f.sty"))
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\generic\oberdiek\catc
hfile.sty"))
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\xstring\xstring
.sty"
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\generic\xstring\xstri
ng.tex"))
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\framed\framed.s
ty"))
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\xcolor\xcolor.s
ty"
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\00miktex\color.
cfg")
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pdftex-def\pdft
ex.def"))
C:\Users\User\Desktop\New folder>set /p x=C:\Users\User\AppData\Local\Enthought\Canopy\User\Scripts\pygmentize.exe 0<nul: 1>>minimal.aex
C:\Users\User\Desktop\New folder>set /p x= 0<nul: 1>>minimal.aex
C:\Users\User\Desktop\New folder>set /p x= 0<nul: 1>>minimal.aex
No file minimal.aux.
("D:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex\context\base\supp-pdf
.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
) (_minted-minimal/default-pyg-prefix.pygstyle)
(_minted-minimal/default.pygstyle)
! Undefined control sequence.
\minted@inputpyg ...}\endcsname \VerbatimPygments
{\PYG }{\minted@PYGstyle }...
l.9 \end{minted}
?
有人知道我的设置有什么问题吗?也许我错过了什么?我对 LATEX 还很陌生。