I'm generating a .png image using the standalone class.

\documentclass[preview, border=0.5 pt, convert={size=650x650,outext=.png}]{standalone}
p(x) = \sum_{i=0}^n a_ix^i, \quad q(x) = \sum_{j=0}^m b_ix^j, \quad m \ge n

and compiling with pdflatex --shell-escape formula.tex

The problem is that there is a lot of unused space in the image as you can see below compared to text,


If I try to shrink the resolution of the x dimension it reduces as well the font size. Is there a way to optimize resolution vs font size?

  • The easy solution is to replace equation with $\displaystyle ...$. OTOH, I did not get a png, just the usual PDF. Commented Aug 31, 2020 at 14:50

1 Answer 1


The problem seems to be in the preview option that sets a fixed text width (which is what you observe as the borders). You can do without the fixed text width using normal $-delimited math, possibly with the \displaystyle macro to switch to "big" sum letters, as the comment suggested.

In particular, this seems to work just right:

\documentclass[border=5pt, convert={size=650x650,outext=.png}]{standalone}
p(x) = \sum_{i=0}^n a_ix^i, \quad q(x) = \sum_{j=0}^m b_ix^j, \quad m \ge n $

PNG with the equation, border added manually using imagemagick

PS. You might want to consider using density instead of a fixed size, which may provide less surprising output in case of tiny or huge equations. In case you really need the equation* environment, you can put it in a minipage, but you need to guess the width manually:

p(x) = ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .