### LaTeX to png

11 March 2008

Part of having a blog involving math is having the ability to easily convert like e^{\pi i} = -1 to . I had been using a wonderful tool over at math.b3co.com 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 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 ScienceSoft.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 1.618034.com (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"?>
<latexresult>
<lateximage location="_url_" source="sciencesoft.at" />
</latexresult>


It's no easier, technically, than socketing directly to the ScienceSoft.at 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.

All included graphics are generated at LaTeX to png .