[Tex/LaTex] Beamer fix position on frames when using only

beameroverlayspausepositioning

I would like to introduce the points of an itemize one by one and present an example in a block below the itemize (for some items). Using \only that's not really a problem – but the positions are not "fixed" like they are with a \pause. I know that I probably have to use \begin{overlayarea} but I don't know how to encapsulate the stuff. Do I have to encapsulate every \item separately?

\documentclass[xcolor=dvipsnames]{beamer} 
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}


\begin{document}

\begin{frame}
Text always present

\begin{itemize}
\item<2-> Item 1

\item<3-> Item 2

\item<4-> Item 3

\item<5-> Item 4
\end{itemize}

\only<4>{
\begin{block}{Block to item 3}
block 1
\end{block}
}

\only<5>{
\begin{block}{Block to item 4}
block 2
\end{block}
}
\end{frame}
\end{document}

Best Answer

The command \visible prevents newly shown items from shifting existing ones around. In your case, I'd combine \visible with \alt as below:

MWE

\documentclass[xcolor=dvipsnames]{beamer} 
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}


\begin{document}

\begin{frame}
Text always present

\begin{itemize}
\item<2-> Item 1

\item<3-> Item 2

\item<4-> Item 3

\item<5-> Item 4
\end{itemize}

\alt<4>{
\begin{block}{Block to item 3}
block 1
\end{block}
}
{\visible<5>{
\begin{block}{Block to item 4}
block 2
\end{block}
}}
\end{frame}
\end{document}

Output

enter image description here