# Inconsistent vertical space after first \begin{equation*}

The AlignBox environment from this TeX.sx answer can produce several consecutive equation* environments (when several pre-declared equation lines are inserted).

When the paragraph preceding the first equation* is more than one line long, the vertical spacing between the first and second equations is larger than for the others:

I'm curious about the reason this occurs (I noticed that when the line is very short, the equation is automatically moved up, to avoid an awkward large blank space).

Is there a workaround, or should I just adapt the macro to group consecutive equations into a gather* environment?

\documentclass{article}
\usepackage{amsmath}
\begin{document}

Hello hello hello hello hello hello hello hello hello hello hello
hello hello hello hello hello hello hello hello hello hello hello.
\begin{equation*}
AAAAAA
\end{equation*}
\begin{equation*}
BBBBBB
\end{equation*}
\begin{equation*}
CCCCCC
\end{equation*}
\begin{equation*}
DDDDDD
\end{equation*}

\end{document}

• @Dario Do you mean leaving a blank line? These answers seem to indicate that it would start the equations at the beginning of a paragraph, which is bad practice. Also, I'd prefer having the first space smaller, rather than have the others larger. Thanks for the idea, though! – Georges Dupéron May 11 '16 at 15:37
• Duperon. Yes this is what I mean. I just posted the MWE. I know it is not really great solution, but it seems to work. – Dario May 11 '16 at 15:39
• Never leave a blank line before a displayed equation, or use two consecutive equations. Use an environment for a multiline display such as align or multline from amsmath – David Carlisle May 11 '16 at 15:41

## 2 Answers

The larger space is \belowdisplayskip which is used for the first equation. You could locally set it to \belowdisplayshortskip. But some multiline display environment is probably better:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
Hello hello hello hello hello hello hello hello hello hello hello
hello hello hello hello hello hello hello hello hello hello hello.%
\begingroup\belowdisplayskip=\belowdisplayshortskip
\begin{equation*}
AAAAAA
\end{equation*}\endgroup
\begin{equation*}
BBBBBB
\end{equation*}
\begin{equation*}
CCCCCC
\end{equation*}
\begin{equation*}
DDDDDD
\end{equation*}

\end{document}


• Not “probably”: certainly. – egreg May 11 '16 at 16:48
• @egreg: I didn't check what the "AlignBox" in the question is meant to do, so I don't know the context of the question. – Ulrike Fischer May 11 '16 at 16:56

Not a nice solution, but it might work (just leave space between \end{} and \begin{}:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

Hello hello hello hello hello hello hello hello hello hello hello
hello hello hello hello hello hello hello hello hello hello hello.
\begin{equation*}
AAAAAA
\end{equation*}

\begin{equation*}
BBBBBB
\end{equation*}

\begin{equation*}
CCCCCC
\end{equation*}

\begin{equation*}
DDDDDD
\end{equation*}
\end{document}


This is what I get:

• No! never leave a blank line before a displayed equation, it produces a spurious empty paragraph that looks like vertical space but is not lost at a page break. – David Carlisle May 11 '16 at 15:40
• Which solution then? I also tried using \vspace{} but it does not work. – Dario May 11 '16 at 15:42
• I just saw your post. You are right. align should solve. Thanks – Dario May 11 '16 at 15:43
• any multiline display environment such as multline or align from amsmath, or even the standard (but deprecated) eqnarray would be better than this. – David Carlisle May 11 '16 at 15:44
• @DavidCarlisle -- you forgot the "obvious" one: gather. – barbara beeton May 11 '16 at 20:30