## Docutils 0.8 in Ubuntu 10.04

In howto on Apr 23, 2012 by theoryl Tagged: , , , , , ,

I wonder if I’m the only person having trouble upgrading Docutils in Ubuntu Lucid Lynx. Docutils is a text processing package, written in Python and for Python, that implements reStructuredText — a plaintext markup language. The Ubuntu 10.04 repository has a really old version 0.6.3. It is missing a feature that is very important to me: the “math” role and directive (added in 0.8).

To upgrade the current version of Docutils, first uninstall the old version. That seems to be the source of all the trouble that I was having. (Before I uninstalled it, all the docutils commands still called the old version 0.6.3). So:

sudo apt-get remove python-docutils

The installation is fairly simple. Download either the snapshot or the stable release listed on the homepage. Then:

tar -xvzf docutils-0.8.1.tar.gz
cd docutils-0.8.1
sudo ./setup.py install

You can check if you have install successfully by doing e.g.

rst2html.py --version

To use LaTeX equations with rst directive:

.. math::
e^{i\pi} = -1

Or with rst role:

:math:e^{i\pi} = -1

When using rst2html.py, one can use --math-output command line option to specify the math display format: MathJax (default), HTML, MathML or LaTeX. To get fancy with math in reStructuredText, see this post.