4

I am working on a presentation and want to show a statement (Th. 1) on slide. On the next slide an argument for the proof should appear under the statement. On the third slide of the frame, the argument should disappear and a statement similar to Th. 1 should become visible.

I tried using the \overprint environment from the beamer class, but the block's still wobble (the documentation of beamer says that this should not be the case). For itemize the \overprint command does work (beamer overprint with itemize).

What do I have to do that Th. 1 is on all three slides on the exact position and nothing wobbles?

MWE:

\documentclass{beamer}
   
\begin{document}
% ----- this works -----
\frame{
\begin{overprint}
\onslide<1>
\begin{itemize}
\item Foo
\item Bar
\end{itemize}
\onslide<2>
\begin{itemize}
\item I replace Foo
\item I replace Bar
\item I am new!
\end{itemize}
\end{overprint}
}

% ----- this does not -----
\begin{frame}{Results}
\begin{overprint}
\onslide<1->{
\begin{block}{Th. 1}
Some statement, given:
\begin{enumerate}[i)]
    \item Foo
    \item Bar
    \item FooBar
\end{enumerate}
\end{block}}
%\vspace*{0.5cm}
\onslide*<2>{
\begin{block}{Lemma}
An Argument for the proof.
\[
E = mc^2.
\]
\end{block}}
\onslide*<3>{
\begin{block}{Th. 2}
Some similar statement, given:
\begin{enumerate}[i)]
    \item Foo
    \item Bar
    \item BarFoo
\end{enumerate}
\end{block}}
\end{overprint}
\end{frame}
\end{document}

1 Answer 1

5

A simple workaround is to use top alignment. Or you can measure the largest block and use overlayarea.

\documentclass{beamer}

\newsavebox{\overprintbox}
   
\begin{document}

\begin{frame}[t]{Results}
\onslide<1->{
\begin{block}{Th. 1}
Some statement, given:
\begin{enumerate}[i)]
    \item Foo
    \item Bar
    \item FooBar
\end{enumerate}
\end{block}}
\begin{overprint}
\onslide*<2>{
\begin{block}{Lemma}
An Argument for the proof.
\[
E = mc^2.
\]
\end{block}}
\onslide*<3>{
\begin{block}{Th. 2}
Some similar statement, given:
\begin{enumerate}[i)]
    \item Foo
    \item Bar
    \item BarFoo
\end{enumerate}
\end{block}}
\end{overprint}
\end{frame}

\begin{frame}{Results}
\sbox\overprintbox{\begin{minipage}[b]{\textwidth}
\begin{block}{Th. 2}
Some similar statement, given:
\begin{enumerate}[i)]
    \item Foo
    \item Bar
    \item BarFoo
\end{enumerate}
\end{block}\vspace*{0pt}\end{minipage}}
\onslide<1->{
\begin{block}{Th. 1}
Some statement, given:
\begin{enumerate}[i)]
    \item Foo
    \item Bar
    \item FooBar
\end{enumerate}
\end{block}}
\begin{overlayarea}{\textwidth}{\dimexpr\ht\overprintbox+5pt}
\onslide*<2>{
\begin{block}{Lemma}
An Argument for the proof.
\[
E = mc^2.
\]
\end{block}}
\onslide*<3>{\usebox\overprintbox}
\end{overlayarea}
\end{frame}

\end{document}

The +5pt is due to how beamer works, I guess, and avoids an overfull warning.

enter image description here

1
  • And @egreg saves the day again. Thanks!
    – Matthias
    Jun 22, 2022 at 13:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .