I decided to use mathtex. It's a nice program indeed, but it needed some tuning for my needs:
You can see the results here: [http://dump.bitcheese.net/xet/mtex.cgi?yourformulahere]. Change mtex to mtexi for inverted output.
Modified Mathtex source (Patch)
Makefile used to build two versions of mathtex used on site