Beginnings of usetex support for pdf backend (by reading dvi files)

I just committed the beginnings of draw_tex for the pdf backend, which
uses the dvi reader in the new file dviread.py. This is all in a very
rudimentary stage, but I'm committing now since I won't likely have
much time to work on this in the near future. In the meantime, if
anyone's interested in developing it further, take a look at
backend_pdf.py for caveats and how to enable it.

The following script produces the attached output; note that the
\alpha is broken (must be some encoding issues) but the underscore
command \_ works, unlike in plain mathtext.

#!/usr/bin/env python
import matplotlib
matplotlib.use('PDF')
from pylab import *
rc('text', usetex=True)
rc('font', serif='Computer Modern Roman', size=10)
subplot(111)
setp(gca(), xticks=[], yticks=[])
text(0.5, 0.5, r'$f(x)=\alpha\_1$', fontsize=10)
savefig('foobar.pdf')

foobar.pdf (44.5 KB)

···

--
Jouni K. Sepp�nen
http://www.iki.fi/jks

This looks like a great start, Jouni. At least three times in the past, I have
tried to get started on writing a dvi parser for exactly this purpose, and I
never could make any real progress on it in the amount of time I had
available. Plus, I was in over my head and had to relearn a lot each time I
started over. I'm really impressed with what you have done. Nice work!

Darren

···

On Monday 09 April 2007 07:40:35 am Jouni K. Seppänen wrote:

I just committed the beginnings of draw_tex for the pdf backend, which
uses the dvi reader in the new file dviread.py. This is all in a very
rudimentary stage, but I'm committing now since I won't likely have
much time to work on this in the near future. In the meantime, if
anyone's interested in developing it further, take a look at
backend_pdf.py for caveats and how to enable it.

The following script produces the attached output; note that the
\alpha is broken (must be some encoding issues) but the underscore
command \_ works, unlike in plain mathtext.

#!/usr/bin/env python
import matplotlib
matplotlib.use('PDF')
from pylab import *
rc('text', usetex=True)
rc('font', serif='Computer Modern Roman', size=10)
subplot(111)
setp(gca(), xticks=, yticks=)
text(0.5, 0.5, r'f\(x\)=\\alpha\\\_1', fontsize=10)
savefig('foobar.pdf')