[Tex/LaTex] Latex-Beamer: overprint-environment wobbles

beameroverlays

I am new to the beamerclass and I am currently trying to write a presentation containing lots of derivations. On one point I want to overlay a derivation by its conclusion and I use the overprint-environment. The problem is that the environment shifts the whole derivation downwards so that the last line is only partially visible. How can I avoid this? There is a workaround by making a second frame, copying the whole content and replacing the derivation with the conclusion, but I do not consider that "elegant" and it would falsify the frame counter.

I would appreciate any help.

A minimal example is attached:

\documentclass[xcolor=dvipsnames]{beamer}
\mode<presentation>
\usetheme{Boadilla}

\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts,amsmath,amssymb,amsthm}

\DeclareMathOperator{\Var}{Var}
\DeclareMathOperator{\E}{\mathbb E} 

\title{Dummy-Titel}
\subtitle{Dummy-Untertitel}
\author{Autor}

\date{\today}


\begin{document}

\begin{frame}{Erwartungswert}
    \begin{itemize}
        \item $\E(X_{t+1} | X_t = i) = \sum_{j=0}^{2N} j \cdot P(X_{t+1}=j | X_t = i)$
        \item $X_{t+1}$ binomialverteilt mit Parametern $n=2N$ und $p=\frac{i}{2N}$:
        $\Rightarrow \E(X_{t+1} | X_t=i) = n \cdot p = i$
        \item Martingal-Eigenschaft: $\E(X_{t+1} | X_t) = X_t$
    \end{itemize}
        \begin{overprint}
            \onslide<1>
            \begin{align*}
                \E(X_t) &= \E(\E(X_{t+1} | X_t)) = \sum_{i=0}^{2N} E(X_{t+1} | X_t = i) \cdot P(X_t = i) \\
                &= \sum_{i=0}^{2N} \left( \sum_{j=0}^{2N} j \cdot P(X_{t+1}=j | X_t = i) \right) \cdot P(X_t = i) \\
                &= \sum_{j=0}^{2N} j \cdot \left( \sum_{i=0}^{2N} \cdot P(X_{t+1}=j , X_t = i) \right) \\
                &= \sum_{j=0}^{2N} j \cdot P(X_{t+1}=j) = \E(X_{t+1})
            \end{align*}
            \onslide<2>
            \begin{equation*}
                \Rightarrow \E(X_0) = \E(X_1) = \E(X_2) = \ldots
            \end{equation*}
        \end{overprint}
\end{frame}
\end{document}

Best Answer

Not very elegant perhaps, but you could simply add some negative vspace before the align*.

\documentclass[xcolor=dvipsnames]{beamer}
\mode<presentation>
\usetheme{Boadilla}

\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts,amsmath,amssymb,amsthm}

\DeclareMathOperator{\Var}{Var}
\DeclareMathOperator{\E}{\mathbb E} 

\title{Dummy-Titel}
\subtitle{Dummy-Untertitel}
\author{Autor}

\date{\today}


\begin{document}

\begin{frame}{Erwartungswert}
    \begin{itemize}
        \item $\E(X_{t+1} | X_t = i) = \sum_{j=0}^{2N} j \cdot P(X_{t+1}=j | X_t = i)$
        \item $X_{t+1}$ binomialverteilt mit Parametern $n=2N$ und $p=\frac{i}{2N}$:
        $\Rightarrow \E(X_{t+1} | X_t=i) = n \cdot p = i$
        \item Martingal-Eigenschaft: $\E(X_{t+1} | X_t) = X_t$
    \end{itemize}
        \begin{overprint}
            \onslide<1>
            \vspace{-.5cm}
            \begin{align*}
                \E(X_t) &= \E(\E(X_{t+1} | X_t)) = \sum_{i=0}^{2N} E(X_{t+1} | X_t = i) \cdot P(X_t = i) \\
                &= \sum_{i=0}^{2N} \left( \sum_{j=0}^{2N} j \cdot P(X_{t+1}=j | X_t = i) \right) \cdot P(X_t = i) \\
                &= \sum_{j=0}^{2N} j \cdot \left( \sum_{i=0}^{2N} \cdot P(X_{t+1}=j , X_t = i) \right) \\
                &= \sum_{j=0}^{2N} j \cdot P(X_{t+1}=j) = \E(X_{t+1})
            \end{align*}
            \onslide<2>
            \begin{equation*}
                \Rightarrow \E(X_0) = \E(X_1) = \E(X_2) = \ldots
            \end{equation*}
        \end{overprint}
\end{frame}
\end{document}