Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

2 Answers 2

up vote 4 down vote accepted

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}
share|improve this answer
    
Ah, thank you very much. That does the trick for me :-) –  Dave Nov 16 '11 at 8:43

Here is another alternative that provide no "wobble" in the transition from one slide to the next.

Instead of using the overprint environment, individual elements are made visible/not by using a combination of \only and \visible overlay specifications. For optimal vertical alignment between the two slides, \vphantom supplied the appropriate vertical spacing in the first line of align* (due to the summation).

enter image description here

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

\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{lmodern,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{align*}
    \visible<1>{\E(X_t)} 
      &\only<1>{= \E(\E(X_{t+1} | X_t)) = \sum_{i=0}^{2N} E(X_{t+1} | X_t = i) \cdot P(X_t = i)}%
       \only<2>{\Rightarrow \E(X_0) = \E(X_1) = \E(X_2) = \cdots \vphantom{\sum_{i=0}^{2N}}} \\
      &\visible<1>{= \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)} \\
      &\visible<1>{= \sum_{j=0}^{2N} j \cdot \left( \sum_{i=0}^{2N} \cdot P(X_{t+1}=j , X_t = i) \right)} \\
      &\visible<1>{= \sum_{j=0}^{2N} j \cdot P(X_{t+1}=j) = \E(X_{t+1})}
  \end{align*}
\end{frame}
\end{document}

The overprint environment itself may have left some gap in addition to what the align* environment would have left above it, causing your items to be shifted down so low. Additionally, the lmodern fonts supported some fonts that were missing from your original MWE.

share|improve this answer
    
That's a very neat trick. Thanks, I'll keep it at the back of my mind. Also thanks for the hint regarding the fonts. I haven't seen the Latex warning. –  Dave Nov 16 '11 at 11:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.