I am editing a rather long text which contains many equations and floats, and encountered a problem with the align
and gather
environments.
MWE:
\documentclass[preview]{standalone}
\usepackage{amsmath}
\begin{document}
Paragraph one. Lorem ipsum dolor sit amet, consecuteur adipiscing elit.
\begin{gather*}
\boxed{\sum_{x=1}^{N} A_x} \\
\boxed{\sum_{x=1}^{N} A_x}
\end{gather*}
Paragraph two. Lorem ipsum dolor sit amet, consecuteur adipiscing elit.
\end{document}
Result:
There is too much vertical space between the first paragraph and the equation, as if an extra empty paragraph was inserted. If I delete the blank line between the first paragraph and the math environment, there is no extra space, but the page can't be broken at that point and I often I end up with orphans. The extra space is not present when I use the equation
environment or \[ \]
:
\documentclass[preview]{standalone}
\usepackage{amsmath}
\begin{document}
Paragraph one. Lorem ipsum dolor sit amet, consecuteur adipiscing elit.
\[ \boxed{\sum_{x=1}^{N} A_x} \]
\[ \boxed{\sum_{x=1}^{N} A_x} \]
Paragraph two. Lorem ipsum dolor sit amet, consecuteur adipiscing elit.
\end{document}
Result:
How can I get rid of the unwanted vertical space, but at the same time allow page breaks before the environment?
Best Answer
Pages should never start with a displayed equation that is not a continuation of a display from the previous page (and this case should be a kind of last resort).
You can automatically allow page breaks inside multiline alignment displays by issuing
(an
amsmath
command) in the document preamble, but TeX will never break a page before a display, unless you play some dirty trick yourself.Never leave a blank line before a display.