LaTeX Beamer + Columns:在一列中更改图像

LaTeX Beamer + Columns: Change Image in one column

我想要一张有两栏的幻灯片。左边是一个项目符号,右边是两个如何计算左边给出的函数的例子:

\begin{frame}{Example Protocol}
\begin{columns}
\begin{column}{.49\textwidth}   
\begin{itemize}
    \item Consider the function: 
        \begin{align*}
            &f: \{0, 1\}^2 \times \{0, 1\}^2 \to \{0, 1\},\
            &f(x, y) = \left\lbrace
                \begin{array}{cl}
                1, & \text{if } x_1 = y_1 \text{ or } y_2 = 1\ 
                0, & \text{else.}
                \end{array} 
            \right.
        \end{align*}\pause
\end{itemize}
\end{column}

\begin{column}{.49\textwidth}
\only<2>{
\begin{figure}
    \centering
    \input{figs/bp1s.tex}
\end{figure}
}\pause
\only<3>{
\begin{figure}
    \centering
    \input{figs/bp2s.tex}
\end{figure}
}
\end{column}
\end{columns}
\end{frame}

我的问题:在此设置中,当我转到下一个叠加层时,左侧的项目向下移动一行。我可以通过使用 \onslide 而不是 \only 来避免这种情况,但这会导致另一个问题,因为第一张图片在右侧遮挡了整个 space,而第二张图片消失了 "out of bounds" 而叠加层 3 上右列的可见部分是空的。

你有正确的处理方法吗?

最好的, 尼克拉斯

有几种方法可以避免这个问题。例如

方法一:

一种方法是将您的图片放置在 overlayarea 中,宽度和高度足以容纳最大的图片

\documentclass{beamer}

\begin{document}

\begin{frame}{Example Protocol 1}
\begin{columns}
\begin{column}{.65\textwidth}   
\begin{itemize}
    \item Consider the function: 
        \begin{align*}
            &f: \{0, 1\}^2 \times \{0, 1\}^2 \to \{0, 1\},\
            &f(x, y) = \left\lbrace
                \begin{array}{cl}
                1, & \text{if } x_1 = y_1 \text{ or } y_2 = 1\ 
                0, & \text{else.}
                \end{array} 
            \right.
        \end{align*}
\end{itemize}
\end{column}
\begin{column}{.3\textwidth}
\begin{overlayarea}{\textwidth}{.45\textheight}
\only<2>{%
\begin{figure}
%    \centering
    \rule{.5\textwidth}{.4\textheight}
\end{figure}
}%\pause
\only<3>{%
\begin{figure}
%    \centering
    \rule{.5\textwidth}{.2\textheight}
\end{figure}
}
\end{overlayarea}
\end{column}
\end{columns}
\end{frame}

\begin{frame}[t]{Example Protocol 2}
\begin{columns}[T]
\begin{column}{.65\textwidth}   
\begin{itemize}
    \item Consider the function: 
        \begin{align*}
            &f: \{0, 1\}^2 \times \{0, 1\}^2 \to \{0, 1\},\
            &f(x, y) = \left\lbrace
                \begin{array}{cl}
                1, & \text{if } x_1 = y_1 \text{ or } y_2 = 1\ 
                0, & \text{else.}
                \end{array} 
            \right.
        \end{align*}
\end{itemize}
\end{column}
\begin{column}{.3\textwidth}
\only<2>{%
\begin{figure}
%    \centering
    \rule{.5\textwidth}{.4\textheight}
\end{figure}
}%\pause
\only<3>{%
\begin{figure}
%    \centering
    \rule{.5\textwidth}{.2\textheight}
\end{figure}
}
\end{column}
\end{columns}
\end{frame}


\end{document}

方法二:

或顶部对齐框架和列

\documentclass{beamer}

\begin{document}

\begin{frame}[t]{Example Protocol 2}
\begin{columns}[T]
\begin{column}{.65\textwidth}   
\begin{itemize}
    \item Consider the function: 
        \begin{align*}
            &f: \{0, 1\}^2 \times \{0, 1\}^2 \to \{0, 1\},\
            &f(x, y) = \left\lbrace
                \begin{array}{cl}
                1, & \text{if } x_1 = y_1 \text{ or } y_2 = 1\ 
                0, & \text{else.}
                \end{array} 
            \right.
        \end{align*}
\end{itemize}
\end{column}
\begin{column}{.3\textwidth}
\only<2>{%
\begin{figure}
%    \centering
    \rule{.5\textwidth}{.4\textheight}
\end{figure}
}%\pause
\only<3>{%
\begin{figure}
%    \centering
    \rule{.5\textwidth}{.2\textheight}
\end{figure}
}
\end{column}
\end{columns}
\end{frame}


\end{document}