I have read lots of questions and answers here but I haven't found a clear Question/Answer.
I need to create a really simple webpage which allows users to enter LaTeX and generate a PNG (or other lightweight image format). The webpage contains only a textarea
and a submit button
and it produces a link like "http://www.example.com/generated-images/cnl344l4jcxlj.png" with the image.
INPUT: already-written latex like
f(x)=\displaystyle\int_{-\infty}^x e^{-t^2}dt
OUTPUT: Link to the generated PNG or GIF image
The processing of the latex code and the generation of the image should happen in the server-side (so no JavaScript)
I'd like to do this in PHP (which I'm pretty good at), but if there are simple-enough libraries I could give it a shot in Perl.
A straightforward implementation in pure C could also work. A program which scanf
s the input latex code and printf
s "image generated at c:/program/image00000000001.gif"
Any free/opensource libraries that do any of this? Any advice in how to proceed? Any special concerns?
http://rinconmatematico.com/latexrender/pictures/35800007a15a3f0e39006dc63f04f1b5.gif
Try:
Look at dvipng. I wouldn't write a wrapper over it in C but in a scripting language.
If it's not a high-traffic website, you can try online rendering with sites like the Online LaTeX Equation Editor. In particular, this site allows you to put LaTaX directly into the URL like the following:
The URL being: http://latex.codecogs.com/gif.latex?\sum_k%20a_k
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With