我有以下简单的 LaTeX 文档...
\documentclass[letterpaper, 10pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{minted}
\usepackage{hyperref}
\hypersetup
{
colorlinks=false,
pdfborder={0,0,0},
}
\begin{document}
\begin{minted}[mathescape,
linenos,
numbersep=5pt,
gobble=2,
frame=lines,
framesep=2mm]{bash}
#!/bin/bash
curl -o wdbc.data http://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/wdbc.data
perl -ne '@f = split/,/; print(join(",", @f[2..31]))' < wdbc.data > wdbc-values.data
perl -ne '@f = split/,/; printf("%s\n", $f[1])' < wdbc.data > wdbc-diagnoses.data
/Applications/MATLAB_R2011b.app/bin/matlab -nodisplay < run-kmeans.m
echo -e "\n\n\n======Results======"
paste -d: wdbc-clusters.data wdbc-diagnoses.data | sort | uniq -c
\end{minted}
\end{document}
我基本上是从 minted 主页复制了示例并插入了一个 shell 脚本。当我尝试排版此示例时,出现以下错误。
standage@gremlin4:~hw04$ pdflatex -shell-escape test.tex
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
\write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, farsi, arabic, croatian, bulgarian, ukrainian, russian, czech, slov
ak, danish, dutch, finnish, french, basque, ngerman, german, german-x-2009-06-1
9, ngerman-x-2009-06-19, ibycus, monogreek, greek, ancientgreek, hungarian, san
skrit, italian, latin, latvian, lithuanian, mongolian2a, mongolian, bokmal, nyn
orsk, romanian, irish, coptic, serbian, turkish, welsh, esperanto, uppersorbian
, estonian, indonesian, interlingua, icelandic, kurmanji, slovenian, polish, po
rtuguese, spanish, galician, catalan, swedish, ukenglish, pinyin, 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))
(/usr/share/texmf-texlive/tex/latex/geometry/geometry.sty
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-texlive/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texmf-texlive/tex/generic/oberdiek/ifvtex.sty)
(/usr/share/texmf-texlive/tex/xelatex/xetexconfig/geometry.cfg)) (./minted.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)
(/usr/share/texmf-texlive/tex/latex/ifplatform/ifplatform.sty
(/usr/share/texmf-texlive/tex/generic/oberdiek/pdftexcmds.sty
(/usr/share/texmf-texlive/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texmf-texlive/tex/generic/oberdiek/ifluatex.sty)
(/usr/share/texmf-texlive/tex/generic/oberdiek/ltxcmds.sty))
(/usr/share/texmf-texlive/tex/generic/oberdiek/catchfile.sty) (./test.w18)))/usr/bin/pygmentize
(/usr/share/texmf-texlive/tex/latex/hyperref/hyperref.sty
(/usr/share/texmf-texlive/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texmf-texlive/tex/latex/oberdiek/hycolor.sty
(/usr/share/texmf-texlive/tex/latex/oberdiek/xcolor-patch.sty))
(/usr/share/texmf-texlive/tex/latex/hyperref/pd1enc.def)
(/usr/share/texmf-texlive/tex/generic/oberdiek/etexcmds.sty)
(/usr/share/texmf-texlive/tex/latex/latexconfig/hyperref.cfg)
(/usr/share/texmf-texlive/tex/latex/oberdiek/kvoptions.sty
(/usr/share/texmf-texlive/tex/generic/oberdiek/kvsetkeys.sty))
Implicit mode ON; LaTeX internals redefined
(/usr/share/texmf-texlive/tex/latex/ltxmisc/url.sty)
(/usr/share/texmf-texlive/tex/generic/oberdiek/bitset.sty
(/usr/share/texmf-texlive/tex/generic/oberdiek/intcalc.sty)
(/usr/share/texmf-texlive/tex/generic/oberdiek/bigintcalc.sty))
(/usr/share/texmf-texlive/tex/generic/oberdiek/atbegshi.sty))
*hyperref using default driver hpdftex*
(/usr/share/texmf-texlive/tex/latex/hyperref/hpdftex.def) (./test.aux)
*geometry auto-detecting driver*
*geometry detected driver: pdftex*
(/usr/share/texmf/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (./test.pyg) (/usr/share/texmf-texlive/tex/latex/hyperref/nameref.sty
(/usr/share/texmf-texlive/tex/latex/oberdiek/refcount.sty)) (./test.out)
(./test.out) (./test.out.pyg
! TeX capacity exceeded, sorry [main memory size=3000000].
'->\leavevmode \kern \z@
\char `\'
l.5 ...o}{-}\PY{n}{diagnoses}\PY{p}{.}\PY{n}{data}
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on test.log.
如果我用其他代码(Perl、R 等)替换 bash 脚本,则不会出现任何问题。我的 bash 脚本是否使用了 minted 不支持的字符?这有记录吗?
笔记:
>>> pygments = __import__('pygments', {}, {}, ['lexers', 'styles', 'formatters'])
>>> print 'Pygments', pygments.__version__
Pygments 1.3.1
答案1
您的 Pygments 版本已过时,并且有一个错误,后来已修复。更新 Pygments 应该可以修复该问题。更新 Pygments 最简单的方法是使用pip
:
pip install --upgrade pygments
(pip
本身可以通过 安装easy_install pip
,而easy_install
安装又需要...)