Vertically center itemize when using beamer \only

For a presentation I want to show how an equation is simplified in steps. When I try to do this using \only, the text jumps around vertically.

Minimal failing example:

\documentclass[11pt]{beamer}
\begin{document}

\begin{frame}
\begin{itemize}
\item<1|only@1> Curvature term drops in 2d:
\begin{equation*}
S = \frac{1}{16 \pi G} \int d^{n}x \sqrt{-\det g} (R - 2 \Lambda)
\end{equation*}

\item<2|only@2> $\Lambda$ is constant:
\begin{equation*}
S = \frac{1}{16 \pi G} \int d^{n}x \sqrt{-\det g} (- 2 \Lambda)
\end{equation*}

\item<3|only@3> Rescale cosmological constant:
\begin{equation*}
S = \frac{-2\Lambda}{16 \pi G} \int d^{n}x \sqrt{-\det g}
\end{equation*}

\item<4|only@4> Integral over space:
\begin{equation*}
S = - \lambda \int d^{n}x \sqrt{-\det g}
\end{equation*}

\end{itemize}

\end{frame}

\end{document}


How can I fix this? Is there a better way to get a similar effect, without using \only?

-

This is what the overprint and overlayarea environments were designed for. In your case, you can use overlayarea and \leavevmode (the latter to prevent the initial "jump"):

\documentclass[11pt]{beamer}
\begin{document}

\begin{frame}
\begin{overlayarea}{\textwidth}{3cm}
\leavevmode
\begin{itemize}
\item<1|only@1>{Curvature term drops in 2d:
\begin{equation*}
S = \frac{1}{16 \pi G} \int d^{n}x \sqrt{-\det g} (R - 2 \Lambda)
\end{equation*}}

\item<2|only@2>{$\Lambda$ is constant:
\begin{equation*}
S = \frac{1}{16 \pi G} \int d^{n}x \sqrt{-\det g} (- 2 \Lambda)
\end{equation*}}

\item<3|only@3>{Rescale cosmological constant:
\begin{equation*}
S = \frac{-2\Lambda}{16 \pi G} \int d^{n}x \sqrt{-\det g}
\end{equation*}}

\item<4|only@4>{Integral over space:
\begin{equation*}
S = - \lambda \int d^{n}x \sqrt{-\det g}
\end{equation*}}
\end{itemize}
\end{overlayarea}
\end{frame}

\end{document}


-
Ops, I thought the title "vertically center itemize" was the problem he wanted to solve :D –  dcmst Jun 28 '13 at 17:10