# Replace overlays for last slide

I would like to create a command/environment for my Beamer presentation that allows me to display blocks/list items/… step by step using <+-> and then, on the last slide, that hides all previously displayed blocks to show only a picture (or a text).

I'm currently doing this by hand, like that:

\documentclass{beamer}
\usepackage{graphicx}

\begin{document}

\begin{frame}
\frametitle{My title}

\begin{onlyenv}<-3>
\begin{block}{Block 1}<+->
Test 1
\end{block}
\begin{block}{Block 2}<+->
Test 2
\end{block}
\begin{block}{Block 3}<+->
Test 3
\end{block}
\end{onlyenv}

\begin{onlyenv}<4->
\includegraphics[width=\textwidth]{example-image-a}
\end{onlyenv}
\end{frame}

\end{document}


However, this is not very practical, as I have to manually compute the slide number and change the value in two places each time I add a block.

I tried using \value{beamerpauses}, \insertframestartpage and \insertframeendpage, but without success.

Is there a way to create a generic command to hide all old overlays and displaying another content?

• Why don't you just put the picture on a new frame with the same title? – Schrödinger's cat Oct 13 at 14:26
• I thought about that by I'd lose the page numbering. – John Doe Oct 13 at 15:51
• You could add \addtocounter{framenumber}{-1} before the extra frame to avoid this problem. – Schrödinger's cat Oct 13 at 19:39