Using \gather and \align together
taking a hint from @PeterGrill, here's a method of combining all the parts into one, using gather*
since the "single" line is to be center-aligned, and the sub-environment aligned
to take care of the multi-line expression.
since you're using amsthm
, i've also taken the liberty to use \qedhere
to position the "tombstone" on the last line of the display.
\documentclass{article}
\usepackage{mathtools}
\usepackage{amsthm}
\begin{document}
\begin{proof}
\begin{gather*}
\begin{aligned}
10 &= 2+2+2+2+2 \\
&= 3+3+3+1
\end{aligned}
\shortintertext{No annoying large space above this line...}
5=5
\qedhere
\end{gather*}
\end{proof}
\end{document}
As per Adjust vspace between multiple align environments you should never use two consecutive display math environments.
Single align
environment:
You could just use a single align*
environment. I would also recommend using \shortintertext
form the \mathtools
package as that provides tighter vertical spacing:
\documentclass{article}
\usepackage{showframe}
\usepackage{mathtools}
\usepackage{amsthm}
\begin{document}
\begin{proof}
\begin{align*}
10 &= 2+2+2+2+2\\
&= 3+3+3+1
\shortintertext{Now this no longer puts an annoying large space above this line...}
5 &=5 \qedhere
\end{align*}
\end{proof}
\end{document}
Using align
within gather
:
Alternatively, you could also use gather
to center some equations and also align
other portions, but this dot not look very good, especially with short text snippets in between.
\documentclass{article}
\usepackage{showframe}
\usepackage{mathtools}
\usepackage{amsthm}
\begin{document}
\begin{proof}
\begin{gather*}
\begin{align*}
10 &= 2+2+2+2+2 &\\
&= 3+3+3+1
\end{align*}
\shortintertext{Now this no longer puts an annoying large space above this line...}
5=5 \qedhere
\end{gather*}
\end{proof}
\end{document}
[Note: the improvement below, actually does not work.]
[Note: there is an important improvement to this code below.]
The closest I can get to a solution is
\documentclass[10pt,a4paper]{article}
\usepackage{amsmath,amsthm,mathtools}
\begin{document}
\begin{proof}
\begin{align*}
15 &= 5+4+3+2+1 = \sum_{i=1}^5 i \\
120&=5\cdot4\cdot3\cdot2\cdot1 = 5! \\
\shortintertext{
\[ e^{\pi i} + 1 = 0 \]
\[ x^n + y^n = z^n \]
}
27 &= 3^3 \qedhere
\end{align*}
\end{proof}
\end{document}
which gives as result
and actually the spacing is quite nice, I think.
Failing important edit
I think the below code is nicer, and even gives better results.
\documentclass[10pt,a4paper]{article}
\usepackage{amsmath,amsthm,mathtools}
\begin{document}
\begin{proof}
\begin{align*}
15 &= 5+4+3+2+1 = \sum_{i=1}^5 i \\
120&=5\cdot4\cdot3\cdot2\cdot1 = 5! \\
\begin{gathered}
e^{\pi i} + 1 = 0 \\
x^n + y^n = z^n
\end{gathered}
27 &= 3^3 \qedhere
\end{align*}
\end{proof}
\end{document}
Credits go to barbara beeton (please vote up her comment on her own answer).