3
votes

I want a slide with two columns. Left is a single bullet, right two examples how to compute a the function given on the left:

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

My issue: In this setup the item on the left moves down one line when I go the next overlay. I can avoid this by using \onslide instead of \only, but this will result in another problem as the first image blocks the whole space on the right and the second image diappears "out of bounds" while the visible part of the right column on overlay 3 is empty.

Do you have a proper way to handle this?

Best, Niklas

1
Are bp1s.tex and bp2s.tex producing images of differing sizes? Even so, I can't replicate your problem. - Werner
This seems to be a pinch in the right direction. Both these files contain only tikz-Code. The resulting drawings have differnt sizes and it helped inserting a dummy node in the smaller one, such that the sizes are equal. I also have ane empty tikz picture of the same size for the first overlay, where the right hand side is empty. There is still a slight movement on the left but not as bad as described here tex.stackexchange.com/questions/44630/… This works just fine for me, but if anyone find a less hacky solution, I'd be glad. - ttnick

1 Answers

4
votes

There are several possibilities to avoid this problem. For example

Approach 1:

One way is to place your image in an overlayarea of sufficient width and height to accommodate the biggest of your images

\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

Approach 2:

Or top align your frame and columns

\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