Latex-Beamer:套印环境抖动

Latex-Beamer:套印环境抖动

我是 beamerclass 的新手,目前正在尝试编写一个包含大量推导的演示文稿。在某一点上,我想用结论覆盖推导,并使用 overprint 环境。问题是环境将整个推导向下移动,因此最后一行仅部分可见。我该如何避免这种情况?有一种解决方法是制作第二个框架,复制整个内容并用结论替换推导,但我认为这并不“优雅”,而且会使框架计数器伪造。

我将不胜感激任何帮助。

附上一个最小示例:

\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}

答案1

也许不太优雅,但你可以vspace在之前简单地添加一些负面内容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}

答案2

这是另一种替代方法,可以使从一张幻灯片到下一张幻灯片的过渡不出现“抖动”。

不使用环境,而是通过使用和叠加规范overprint的组合来使各个元素可见/不可见。为了在两个幻灯片之间实现最佳的垂直对齐,在第一行中提供了适当的垂直间距(由于求和)。\only\visible\vphantomalign*

在此处输入图片描述

\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}

环境overprint本身可能除了环境align*在其上方留下的间隙外还留下了一些间隙,导致您的物品被移得如此之低。此外,lmodern字体支持原始 MWE 中缺少的一些字体。

相关内容