4

I'm getting whitespace on the left of a standalone document when rendering equations in the mode in which they are surrounded by [ and ] (I think that's the mode in which they are supposed to be on their own line. Any ideas how to prevent this?

\documentclass[preview]{standalone}
\usepackage{amsmath,array}    
\begin{document}    
\[ 2x + 8 + 3x = 6x \]    
\end{document}
  • 4
    Don't use preview and type the equation as $\displaystyle ...$ – egreg Jun 05 '17 at 22:41
  • That worked. Can you add it as an answer? Also, why do so many standalone examples I've seen specify to use 'preview' (just curious). – composerMike Jun 05 '17 at 23:53
  • I've never seen it before. According to the manual: If enabled the class options varwidth, preview and beamer require the package or class of the same name. See also https://tex.stackexchange.com/questions/244348/make-only-one-page-for-each-chapter – John Kormylo Jun 06 '17 at 03:36

1 Answers1

1

As far as I can see, preview is not able to crop the part at the left of the display.

To be honest, I never use that option; it's easier to use inline math mode, with \displaystyle to emulate a display.

\documentclass{standalone}
\usepackage{amsmath,array}
\begin{document}
$\displaystyle 2x + 8 + 3x = 6x$
\end{document}

For alignments you can use the inner forms, for instance

\documentclass{standalone}
\usepackage{amsmath,array}
\begin{document}
$\begin{gathered}
  2x + 8 + 3x = 6x \\
  5x + 8 = 6x
\end{gathered}$

\end{document}

No \displaystyle is needed, because it's done by default in these environments.

egreg
  • 1,121,712