# Beamer overlay only/visible

I am trying to change a formula between two slides. Here is an MWE

\documentclass{beamer}

\begin{document}

\begin{frame}{Title}
Something before\\
\bigskip
$% B\left(% \only<1>{A_2[i]}% \only<2>{A_L[i]}% \right) =% \only<1>{C_1 + C_2}% \visible<2>{\displaystyle\sum_{k=1}^{L} C_k}% \quad \text{text here }% \only<1>{a,b,c,}% \only<2>{a,b,c,\ldots,z}$

\end{frame}

\end{document}


As you can see, there is a problem with the position of "text here" in the first slide. If I put only instead of visible, that problem is solved but then everything moves during the transition. Is there a way to solve both issues?

The command \vphantom in useful in this case. It will reserve the vertical space required by the sum and thus prevent "wobbling" of the formula during overlays.

\documentclass{beamer}

\begin{document}

\begin{frame}{Title}
Something before\\
\bigskip
$% B\left(% \only<1>{A_2[i]}% \only<2>{A_L[i]}% \right) =% \only<1>{C_1 + C_2 \vphantom{\displaystyle\sum_{k=1}^{L} C_k}}% \only<2>{\displaystyle\sum_{k=1}^{L} C_k}% \quad \text{text here }% \only<1>{a,b,c,}% \only<2>{a,b,c,\ldots,z}$

\end{frame}

\end{document}

• Yes, this is exactly what I wanted. So I learned a new command: vphantom: maybe one day I will know them all... Thank you! – minomic Sep 20 '16 at 12:16
• What about horizontal space? The text here a,b,c still moves left and right... – Alex Oct 28 '17 at 13:30
• @Alex For horizontal spacing you can do the same with \hphantom – samcarter_is_at_topanswers.xyz Nov 1 '17 at 12:32