# Beamer: using \only makes vertical spacing to change

My presentation slide has 3 "steps", meaning initially there's something written at first, then one more part appears, then one more. I'm using the \only<> command for this (I cannot use itemize \item<> now).

My problem is at every "step" the spacing between lines reduces by a bit, making an annoying shrinking effect 2 times. When all 3 parts are on the slide everything fits nicely. I tried inserting various \vspace{-1em} commands to have a reduced from the beginning, but the effect remains.

I made a MWE, my slide has the same structure:

\documentclass[10pt]{beamer}

\usetheme{metropolis}
\usepackage{lipsum}

\begin{document}
\begin{frame}[t]{Title}
\only<1->{
\begin{enumerate}
\item  List item $(2^n, 3^n, 4^n, \dots)$
\begin{itemize}
\item  \lipsum[1][1] $(2^n, 3^n, \dots)$
\item[] \lipsum[1][2]: $e^n$
\item  \lipsum[1][3] $(2^n, 3^n, \dots)$
\item[] \lipsum[1][4] $e^n$
\end{itemize}
\item  List item $2^{abc} \bigcup 3^\text{def}$
\end{enumerate}
}
\only<2->{
\lipsum[2][1]
\begin{eqnarray*}
\tau(n) & \leq & 2^n \\
& \leq & n^{O(\log n)}
\end{eqnarray*}
}
\only<3->{
\lipsum[2][2]: $$a(n) = \sum_i b_i$$
}
\end{frame}
\end{document}


You are only adding stuff to your frame and don't replace text, so you can simply use \visible instead of \only:

\documentclass[10pt]{beamer}

\usetheme{metropolis}
\usepackage{lipsum}

\begin{document}
\begin{frame}[t]{Title}
\visible<1->{
\begin{enumerate}
\item  List item $(2^n, 3^n, 4^n, \dots)$
\begin{itemize}
\item  \lipsum[1][1] $(2^n, 3^n, \dots)$
\item[] \lipsum[1][2]: $e^n$
\item  \lipsum[1][3] $(2^n, 3^n, \dots)$
\item[] \lipsum[1][4] $e^n$
\end{itemize}
\item  List item $2^{abc} \bigcup 3^\text{def}$
\end{enumerate}
}
\visible<2->{
\lipsum[2][1]
\begin{eqnarray*}
\tau(n) & \leq & 2^n \\
& \leq & n^{O(\log n)}
\end{eqnarray*}
}
\visible<3->{
\lipsum[2][2]: $$a(n) = \sum_i b_i$$
}
\end{frame}
\end{document}


• Thank you very much, it worked! Is there an explanation why \only<> had this behaviour? Also what is the difference between only and visible? – Rolf Nov 28 '18 at 16:57
• @Rolf The main difference is that \only makes the content only appear on the desired slides, it is not there on the other slides .Whereas \visible makes it visible, which means that content is still there on the other slides, just not visible and thus reserves the required space etc. – user36296 Nov 28 '18 at 16:59