Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have the following simple LaTeX document...

\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}

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
(./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.

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?

Note:

>>> pygments = __import__('pygments', {}, {}, ['lexers', 'styles', 'formatters'])
>>> print 'Pygments', pygments.__version__
Pygments 1.3.1
share|improve this question
    
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
show 4 more comments

1 Answer

up vote 2 down vote accepted

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 …)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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