1

I am trying to use the Texments Latex package on Ubuntu to do syntax highlighting. Texments is a wrapper around Pygments. I installed Texments and followed the steps to add the style file to the path. But when I try to compile the .tex file, I get the error.

!Undefined Control Sequence

and then it prints out a bunch of wierd characters and places the ? prompt. Anybody facing this error? What is the resolution?

If there is any other better way to provide syntax highlighting of source code I would be glad to accept it.

I know there is something called "listings" but frankly, i did not find the colors so good in it.

Thanks,

user855
  • 19,048
  • 38
  • 98
  • 162

2 Answers2

2

Perhaps you could give minted a try … it basically does the same as texments but has more features and is a little more robust in the face of errors.

Furthermore, as the maintainer of minted I’m always glad of error reports. ;-)

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
0

Texments uses a special control sequence for pdftex to allow shell escapes, needed to call the pygmentize binary. You need to call it with pdflatex, and you need to pass pdflatex the -shell-escape switch. Cf. the texments documentation.

Charles Stewart
  • 11,661
  • 4
  • 46
  • 85
  • You are referring to pdftex or pdflatex command? I did "pdflatex -shell-escape ants.clj" Is this wrong? This is what I understood from the doc. – user855 Dec 18 '09 at 13:49
  • pdflatex: I've edited my answer. pdflatex should be run on the .tex file: if you have external code, you should use the \includecode{filename.ext} to refer to the code. pdflatex will then run pygmentize -on this file, creating a temporary latex file that it will then \input. You shouldn't be running pdflatex on any *.clj files. – Charles Stewart Dec 18 '09 at 14:09
  • Oh .. That was my typo ... I did pdflatex -shell-escape on the .tex file only. And that gave me that error. – user855 Dec 18 '09 at 16:45
  • Looks like you've got a debugging task. I'd start with looking at the *.out.pyg file that the pygmentize creates (or should do!) when invoked by pdflatex. For a wild guess, weird characters sounds like the -f latex option might be being ignored for some reason, so that you are getting junk passed into pdftex's gentle digestive system... Good luck! – Charles Stewart Dec 18 '09 at 21:53