< a quantity that can be divided into another a whole number of time />

Syntax highlighting in Latex

December 26, 2010

I just discovered the minted $\LaTeX$ package to highlight source code. Perfect! I never liked the listings package.

Minted has been developed by Konrad Rudolph. It relies on Pygments which is easily installed using, e.g.:

$ sudo easy_install Pygments
$ cat >
import numpy
print numpy.__version__
$ pygmentize -f html -O full -o 1.html


Here is a short example of rendering R and Python code:


The source file is here: test_minted.tex. To compile, just run:

$ xelatex -shell-escape test_minted.tex

What I like is:

I seem to remember having tried the highlight program, but I cannot find any trace of it on my old computer.


See Also

» Switching to Biblatex » Upgrading Context