I would like to output only one equation, not on a whole page, but document to fit size of the equation.
Just like the image output from the codecogs website.
How can I do this with LaTeX?
I would like to output only one equation, not on a whole page, but document to fit size of the equation.
Just like the image output from the codecogs website.
How can I do this with LaTeX?
For example, class standalone can be used:
\documentclass[border=1pt]{standalone}
\begin{document}
\mbox{$\displaystyle E=mc^2$}
\end{document}
Remarks:
TeX only sees character bounding boxes of the font, not the bounding boxes of the visual appearance of the glyphs, thus it is possible that the visual appearances exceed the font character boxes. There I have added 1pt additional margin here by option border=1pt.
I do not know, why \[...\] or environment displaymath is not working, therefore I have simulated it by \mbox{$\displaystyle ...$}.
You can also generate the equation on a page on its own with page style empty:
\documentclass{article}
\pagestyle{empty}
\begin{document}
\[ E=mc^2 \]
\end{document}
After the pdflatex run the white margins can be cropped by pdfcrop, that
uses Ghostscript's bbox device to determine the visual bounding box.
border=1pt in the example code. (in my experience, standalone results in a page that is much too tight.) regarding pdfcrop, i can confirm that it does a very nice job.
– barbara beeton
Jun 04 '13 at 17:45
emptyand via thestandalonedocument class create an equation-only "page". – Werner Jun 04 '13 at 17:35