# Beamer: Correct vertical alignment using \only

I'll get straight to the point. MWE:

\documentclass{beamer}
\usetheme{metropolis}

\begin{document}

\begin{frame}[t]{title}
\begin{itemize}
\item 0
\only<+>{
\item a
}
\only<+>{
\item b
\item c
}
\only<+>{
\item d
\item e
\item f
\item
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
}
\end{itemize}
\end{frame}
\end{document}


I.e. 0 stays at the top all the time, a is on the first slide then leaves, b and c come and leave on slide two and so forth.

The problem is, that d-g are very long and thus on the third slide item 0 floats very slightly to the top (less than say 0.5em). However, I still have enough space at the bottom of the slide to not have this happen. Frame option [t] does not seem to help. This is super irritating as the third slide seems to be something totally new to the eye at first.

I'm sure there is a very easy fix to this. I appreciate any help. Many thanks!

• Welcome to TeX.Stackexchange! Can you make a minimal working example (MWE) that actually reproduces the problem? If I add the necessary stuff to compile your code fragment, "0" stays at the exact same place on all slides. – samcarter_is_at_topanswers.xyz Dec 13 '18 at 22:29
• I edited the MWE according to your suggestions. Many thanks! The problem is really subtle and is best seen in full-screen pdf. – axelniemeyer Dec 13 '18 at 22:42

You can solve this problem by wrapping the whole itemization in an overlay area which is height enough to accommodate even the items with the long text:

\documentclass{beamer}
\usetheme{metropolis}

\begin{document}

\begin{frame}[t]{title}
\begin{overlayarea}{\textwidth}{.86\textheight}
\begin{itemize}
\item 0
\only<+>{%
\item a
}
\only<+>{%
\item b
\item c
}
\only<+>{%
\item d
\item e
\item f
\item
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
ggggggggggggggggggggggggggggggggggggggggg
}
\end{itemize}
\end{overlayarea}
\end{frame}
\end{document}