I have the following simple LaTeX document...

\documentclass[letterpaper, 10pt]{article}


  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


I've essentially copied the example from the minted home page and inserted a shell script. When I try to typeset this example, I get the following error.

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
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.
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/xelatex/xetexconfig/geometry.cfg)) (./minted.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
(/usr/share/texmf-texlive/tex/generic/oberdiek/catchfile.sty) (./test.w18)))/usr/bin/pygmentize

Implicit mode ON; LaTeX internals redefined
*hyperref using default driver hpdftex*
(/usr/share/texmf-texlive/tex/latex/hyperref/hpdftex.def) (./test.aux)
*geometry auto-detecting driver*
*geometry detected driver: pdftex*
[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.

If I replace the bash script with other code (Perl, R, etc), I have no problems. Does my bash script use characters that are not supported in minted? Is this documented anywhere?


>>> pygments = __import__('pygments', {}, {}, ['lexers', 'styles', 'formatters'])
>>> print 'Pygments', pygments.__version__
Pygments 1.3.1
  • It seems to me that the problem is the mathescape flag. Removing it worked for me, although according to minted documentation math is only rendered in comments. Could this be a bug in minted? – guillem Apr 12 '12 at 6:40
  • 1
    I notice that your version of minted is in the current directory. You may have a version mismatch: which version of minted are you using? (The example is Works For Me using an up to date TeX Live 2011 and Pygments.) – Joseph Wright Apr 12 '12 at 8:02
  • minted simply dispatches the handling of mathescape. This bug is either in Pygments (either in the lexer or the formatter) or in fancyvrb. I’ve just had a look at the relevant parts in the source code of Pygments and I’m unable to find an obvious bug. The $ is properly escaped, and should be unable to trigger math mode. – Konrad Rudolph Apr 12 '12 at 9:11
  • That said, what version of Pygments are you using? If I remember correctly, earlier versions of Pygments had this bug. – Konrad Rudolph Apr 12 '12 at 9:12
  • 1
    @Daniel The current version appears to be 1.5. You can install it using pip or easy_install. – Konrad Rudolph Apr 12 '12 at 12:07

Your version of Pygments is outdated, and had a bug that was subsequently fixed. Updating Pygments should fix the problem. The easiest way to update Pygments is to use pip:

pip install --upgrade pygments

(pip itself can be installed via easy_install pip, which, in turn, requires easy_install to be installed …)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.