[Tex/LaTex] How to export an equation as an image without background


For example, if we have a equation on a file like:



\usepackage{amsmath, amssymb, graphics, setspace}


How export it as a png image, without background? (Just the equation, without white background).

(I'd like a full comand to do this, compiling the .tex file and getting a png image as output)

I need this to generate equation images to a presentation.

Best Answer

Use convert from from ImageMagick:

pdflatex formula.tex
convert -density 300 formula.pdf -quality 90 formula.png

Here is the resulting PNG file:

enter image description here

This solutions is from TeX to image over command line, which you should see as this will allow you to specify the formula on the command line.