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 > 1.py
$ pygmentize -f html -O full -o 1.html 1.py
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:
- Its syntax looks like that for the listings package, so it’s easier to switch to it.
- It has good unicode support.
- It offer full-support for R, and more esoteric language that I like (e.g., Asymptote), but try
pygmentize -L lexers at the shell prompt.
I seem to remember having tried the highlight program, but I cannot find any trace of it on my old computer.
» Switching to Biblatex
» Upgrading Context