## LaTeX formula to image (PNG)

**Problem**

With LaTeX you produce a nice formula that you would like to *crop* and convert to an *image*.

**Solution**

Let’s see the following simple LaTeX source:

\documentclass{article} \pagestyle{empty} \begin{document} $a^2+b^2=c^2$ \end{document}

Save it as `file.tex`

and execute “`latex file.tex`

“, which will produce a DVI output (`file.dvi`

). The image conversion is done the following way:

dvipng -T tight -x 1200 -z 9 file.dvi -o file.png

**Ref.:** I saw this conversion technique in justinvh’s Markdown-LaTeX project. If your goal is to include LaTeX formulae in HTML, try his script.

Categories: latex
dvi2png, latex to png, maths

This website is so great :)

Thank you SO much! :)

thanks so much. Outstanding site, by the way :)

Thank you guys. And I just complained the other day that I get no feedbacks :)

Nice tip !

How to create an image of difficult formula in five seconds :)

Thanx.