Spacing in beamer seems to change when \pause is added
Yes, \pause
inserts "something" on an empty line in your instance. You could get rid of it by "jumping back" a line using \vspace*{-\baselineskip}
before \pause
:
\documentclass{beamer}% http://ctan.org/pkg/beamer
\begin{document}
\begin{frame}
Without pause:
\[A\]\[B\]
Not too much space between displayed equations.
\end{frame}
\begin{frame}
With pause:
\[A\]\vspace*{-\baselineskip}\pause\[B\]
Too much space between the equations.
\end{frame}
\end{document}
Usually it's not recommended to use one displayed equations right after the other. In such cases you would do something like
\begin{gather*}
A \\ B
\end{gather*}
The problem is that \pause
doesn't work reliably in amsmath
environments, but you can use the fix from this answer of mine:
\documentclass{beamer}
\makeatletter
\let\save@measuring@true\measuring@true
\def\measuring@true{%
\save@measuring@true
\def\beamer@sortzero##1{\beamer@ifnextcharospec{\beamer@sortzeroread{##1}}{}}%
\def\beamer@sortzeroread##1<##2>{}%
\def\beamer@finalnospec{}%
}
\makeatother
\begin{document}
\begin{frame}
Without pause:
\begin{gather*}
A \\
B
\end{gather*}
Not too much space between displayed equations.
\end{frame}
\begin{frame}
With pause:
\begin{gather*}
A \\ \pause
B
\end{gather*}
Same space between the equations.
\end{frame}
\end{document}
Let me point out that the spacing differs from the one you get with \[A\]\[B\]
. On the one hand, gather
doesn't "see" that the line Without pause
is short, so it puts more vertical space between that line and A
. On the other hand, the space between A
and B
becomes smaller; this can be adjusted by using \\[1ex]
instead of \\
. (Adjust the 1ex
to your needs.)
If you want to stick with two seperate displays: as Werner said, \pause
inserts something (namely, one or two \pdfliteral
s) on an otherwise empty line, which gives an additional vertical space of one \baselineskip
. One can prevent TeX from ever putting this additional vertical space by using
\par\pause\noindent
instead of \pause
: the \par
ends the empty line after the first display, the \noindent
keeps the empty line before the second display empty (and \parskip
is zero in beamer
); see also this answer of mine for details.