LaTeX to png

11 March 2008 Ironic update (2020-12-30)

MathJax is now fast, robust, and way prettier than a downsampled graphic. Accordingly, this blog has moved completely off of LaTeX to png. This post remains for posterity.

Original post (2008-03-11)

Part of having a blog involving math is having the ability to easily convert \( \LaTeX \) like e^{\pi i} = -1 to \( e^{\pi i } = -1 \). I had been using a wonderful tool over at to do my scripted conversions (a PHP socket is a wonderful thing), but their backend dropped out one day and went who knows where.

The Internets are pretty short on tools to do \( \LaTeX \) conversion. Although there is a capable Perl script to solve the problem, those of us without console-capable servers are at a loss. Fortunately, there is a freely-available, fairly powerful tool available at (credit where credit is due). Unfortunately, it's housed in a good deal of unnecessary filler — HTML formatting and the like — which make scripting a bit of a pain.

Enter a new layer of abstraction: LaTeX to png at (with free hosting of the results). The script is accessible directly through the link above, but the key is that it readily accepts sockets. Pass ?xml to the page as a GET parameter, and then pass dpi=[int] and tex=[latex] through POST. The return is easily parseable, coming as

<?xml version="1.0"?>
	<lateximage location="_url_" source="" />

It's no easier, technically, than socketing directly to the script, but the output is nicer for sure. Now that I've got my own conversion scripts running on it, I'm only three (socketed) layers of abstraction from the actual software.

Included \(\LaTeX\) graphics are generated at LaTeX to png or by MathJax.

contemporary entries


there are no comments on this post