7

enter image description here

\documentclass[preview,border=12pt,varwidth]{standalone}
\usepackage{amsmath}
\begin{document}
\abovedisplayskip=0pt\relax
\begin{gather*}
6x^2-30x+36=0\\
6(x^2-5x+6)=0\\
6(x-2)(x-3)=0\\
x-2=0 \quad \text{or} \quad x-3=0\\
x=2 \quad \text{or} \quad x=3
\end{gather*}
\end{document}

Is it a bug?

8
+50

Putting this in gathered inside equation* removes the whitespace:

Sample output

\documentclass[preview,border=12pt,varwidth]{standalone}

\usepackage{amsmath}

\begin{document}

\abovedisplayskip=0pt\relax
\begin{equation*}
  \begin{gathered}
    6x^2-30x+36=0\\
    6(x^2-5x+6)=0\\
    6(x-2)(x-3)=0\\
    x-2=0 \quad \text{or} \quad x-3=0\\
    x=2 \quad \text{or} \quad x=3
  \end{gathered}
\end{equation*}

\end{document}

The problem comes from the varwidth package, used by standalone. Its minimal "documentation" in the header of varwidth.sty says:

% AMSmath environments have not been tried, and undoubtedly fail.

A small test document demonstrates the behaviour we are seeing above:

varwidth sample

\documentclass{article}

\usepackage{varwidth,amsmath}

\begin{document}

\fbox{\begin{varwidth}{15cm}
  \begin{equation*}
    \begin{gathered}
      6x^2-30x+36=0\\
      6(x^2-5x+6)=0
    \end{gathered}
  \end{equation*}
\end{varwidth}}

\fbox{\begin{varwidth}{15cm}
  \begin{gather*}
      6x^2-30x+36=0\\
      6(x^2-5x+6)=0
  \end{gather*}
\end{varwidth}}

\end{document}
  • Why is it so any inside thoughts please ? – texenthusiast May 21 '13 at 8:12
  • @texenthusiast See my updated answer – Andrew Swann May 21 '13 at 9:10
  • @AndrewSwann Thanks for your brilliant insights. – texenthusiast May 21 '13 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.