I am familiar with using LaTeX on online websites (like MathOverflow or Physicsforums). My input is rendered using MathJax. However, I do not understand the LaTeX environment in its native OS form. I have downloaded MacTeX, and all I would like to do is make tiny little .png or .jpg files that each contain one equation.
After some Googling, I have tried something along the lines of:
\documentclass[preview]{standalone}
\begin{document}
\begin{equation}
\frac{1}{2} = 0.5
\end{equation}
\end{document}
followed by
pdflatex equation.tex
convert -density 300 equation.pdf -quality 95 equation.png
(using ImageMagick's convert
program), but the output contains a number next to my equation that I can't seem to get rid of. Also, this seems like a lot of work, and I don't need a whole documentclass
just for one equation. Not to mention pdflatex
produces a bunch of other auxiliary files that clutter up my directory during the conversion process. Is there some way I can just easily go from a file containing
\frac{1}{2} = 0.5
to equation.png
? Better yet, is there a simple way I can take a file containing a list of equations and have each of them converted into their own little .png image?
Best Answer
standalone
class is sufficient. You can enable themulti
option, so that the contents of each (math) environment is cropped to its own page in a PDF file. Then you can either save each page directly as a.png
image (Acrobat Pro, and perhaps Adobe Reader, allows you to do it in one go), or you can use theconvert
functionality (need Image Magick) provided withstandalone
. For the latter method, see Section 4.6 of thestandalone
documentation.In the example below I define a new environment
mymath
, which is basically inline math with display style.MWE
Output