Hi all,

As many of you know I have something of an interest (some would say
unhealthy one) in the LaTeX output produced by Sympy. While this is
currently at a very high standard (I would go so far as to say that
Sympy produces the best LaTeX output of all major CAS software) the
problem of rendering the outputted LaTeX still stands.

A couple of days ago Ondřej pointed me to Mathtext, which is the TeX
rendering library for matplotlib. Over the last day or so I have been
toying around with it. My conclusions are:

1. The code is a textbook (dare I say TeX-book) implementation of the
algorithm used internally by TeX to typeset equations. It is reasonably
feature complete, however some extensions (such as \operatorname{}) are
missing.

2. The code has a minimal dependency on matplotlib, only really making
use of the rendering backends, which are themselves very simple.

3. There is, however, a dependency on Freetype -- which although not bad
(it is available on all platforms and very few systems, *nix or
otherwise do not have a copy of it somewhere) -- is not ideal.

4. The output is of reasonable quality -- however some of the spacing
rules appear to be in need of tweaking.

5. Many of the backends which it targets are redundant: SVG, AGG, PS/PDF
and raw bitmap are all eclipsed by Cairo (which provides a common API
for all of them). Therefore can probably be omitted.

6. Parsing is done by way of pyparsing and appears to be quite clean,
however will need extending in order to support enough of TeX.

The potential gains from splitting it off are:

1. Easy equation rendering for all Python GUI applications. Producing
LaTeX is easy, and Cairo/Qt (the two backends I am seriously interested
in) are both widely used for GUI apps.

2. Speed. Server-side equation rendering should be possible with minimal
overhead. (Just parsing + text rendering.)

3. Flexibility. It will be possible to grab a LaTeX equation as an
SVG/PNG/PDF. This could be useful for web-based systems. (At least three
major browsers will take a pop at rendering an SVG.)

Overall I believe it to be worthwhile to take the effort to split it
from matplotlib and make it into its own project.

Hence I am currently interested in the opinions of others on the idea. I
am aware that there was a GSoC proposal for it a year or so ago and am
potentially interested in applying this year. However, this all depends
on if you think the project is a worthwhile undertaking.

Comments/opinions/ideas? Should I consider this as a GSoC project?

Regards, Freddie.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to