In LaTeX I can make a document to be exactly the size of the content:
\documentclass{article}
\usepackage[active]{preview}
\begin{document}
\begin{preview}
\[
\pi = \sqrt{12}\sum^\infty_{k=0} \frac{(-3)^{-k}}{2k+1}
\]
\end{preview}
\end{document}
And compile that with
latex foo.tex
dvipng -T tight -D 231.26 -o foo.png foo.dvi
it makes an image exactly the size of the content (formula).
How do I get the same with XeLaTeX?
I need that because I use inkscape export to latex for images -- and sometimes I need the images as standalone files, not inside a tex document.
Edit:
Here's a full MWE:
\documentclass{article}
\usepackage{todonotes}
\begin{document}
\missingfigure[figwidth=6cm]{}
\end{document}
I actually use
\begin{figure}
\centering
\def\svgwidth{1\columnwidth}
\input{2dSqFermi_2el.pdf_tex}
\end{figure}
as a figure (that's what "inkscape export to latex" is about) -- but that's not important. So in the initial MWE I've just used formula. I see that the given answers already solve that.


