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

问题描述 投票:1回答:1

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

\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来避免这种情况,但是这将导致另一个问题,因为第一个图像阻挡了右边的整个空间,第二个图像显示“越界”,而右边列的可见部分覆盖3是空的。

你有正确的方法来处理这个问题吗?

最好,尼克拉斯

latex beamer
1个回答
1
投票

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

方法1:

一种方法是将图像放置在足够宽度和高度的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}

enter image description here

方法2:

或者顶部对齐框架和列

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

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.