# How to minimize the pagesize?

is there a way to generate a (single-page) PDF with pagesize that is just large enough for the text that I want to display?

Perhaps something along these lines:

  \documentclass{article}
\pagestyle{empty}
\usepackage[papersize=minimal]{geometry}
\begin{document}
$Some beautiful formula$
\end{document}


And then produce a PDF with a pagesize that is just enough for the "beautiful formula".

• See the standalone class. Feb 13, 2020 at 14:21
• @UlrikeFischer That seems indeed to be the solution. I'll "play" with it. Danke! Feb 13, 2020 at 14:31

For a single line and no equation number, use \displaystyle:

\documentclass{standalone}
\begin{document}
$$\displaystyle E=mc^2$$
\end{document}


For multiple lines with no equation numbers, you can abuse a tabular.

\documentclass{standalone}
\usepackage{array}

\begin{document}
\begin{tabular}{@{}>{$\displaystyle}r<{\null$}@{}>{$\displaystyle\null}l<{$}@{}}
E &= mc^2 \\
e^{i\theta} &= \cos\theta + i\sin\theta
\end{tabular}
\end{document}