Thursday, December 17, 2009

How to render Latex in custom application?

I want to add some formulas rendered by Latex to my application. What's the best way to do so? Is there any documentation about this?How to render Latex in custom application?
no. there's no a extern api to do so. the (La)TeX is an interpreter that interprets a source, and spits out dvi, or pdf (with pdftex)...





the path will be to create a source with the formula; call (using system in C or similar) the tex on that temporary source; convert the dvi into an image... and strip it.


then delete all temporary.


you can cache to avoid too much work.





maybe other solution exists (wikipedia e.g. does it, but... I believe it achieves the result running a TeX system on the host!)





once you get an image, you can put wherever you need it in your application.





another way could be to reimplement the ';engine';... the tex source is downloadable, so you can see how it works...





You can also take a look at TeX-math


http://www.tex-math.net/





in my experience, the programs that supported TeX formulas, requested a whole TeX system to be installed... so they likely use the TeX executable to generate the image.






No comments:

Post a Comment