1

I have tried a great suggestion from a previous question I asked where I experienced a similar problem using \vphantom unfortunately it didn't work in the following example:

I have a frame with two columns: left column will go from itemize text -> image 1 -> image 2 right column will go fromimage 3 -> image 3 -> image 4`

When I go from slide 1 to slide 2 the image 3 which should stay the same moves. Any tips on how to prevent this behaviour?

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{braket}
\usepackage{geometry}
\usepackage{empheq}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{animate}
%\usepackage[backend=biber,url=false,doi=false,isbn=false,firstinits=true]{biblatex}


\begin{document}

    \begin{frame}{Stuff}{More stuff}
        \begin{columns}[T]
        \begin{column}[T]{0.5\textwidth}
            \onslide<1>{
            \begin{itemize}
                \item text 1
                \item text 2
            \end{itemize} }
            \includegraphics<2>[width=\textwidth]{measurement_1.png}
            \includegraphics<3>[width=\textwidth]{measurement_2.png}
        \end{column}
        \begin{column}[T]{0.5\textwidth}
            \includegraphics<1-2>[width=\textwidth]{meas3.png}
            \includegraphics<3>[width=\textwidth]{meas4.png}
        \end{column}
        \end{columns}
    \end{frame}


\end{document}
evan54
  • 313
  • 3
  • 9

2 Answers2

2

This is what overlayarea was designed for in beamer; the syntax is:

\begin{overlayarea}{<width>}{<height>}
...
\end{overlayarea}

A complete example:

\documentclass[demo]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{subfig}
\usepackage{braket}
\usepackage{empheq}
\usepackage{animate}
%\usepackage[backend=biber,url=false,doi=false,isbn=false,firstinits=true]{biblatex}


\begin{document}

    \begin{frame}{Stuff}{More stuff}
\begin{overlayarea}{\textwidth}{\textheight}
        \begin{columns}[T]
        \begin{column}[T]{0.5\textwidth}
            \onslide<1>{
            \begin{itemize}
                \item text 1
                \item text 2
            \end{itemize} }
            \includegraphics<2>[width=\textwidth]{measurement_1.png}
            \includegraphics<3>[width=\textwidth]{measurement_2.png}
        \end{column}
        \begin{column}[T]{0.5\textwidth}
            \includegraphics<1-2>[width=\textwidth]{meas3.png}
            \includegraphics<3>[width=\textwidth]{meas4.png}
        \end{column}
        \end{columns}
\end{overlayarea}        
    \end{frame}


\end{document}

enter image description here

Changing the height argument, you can get different vertical alignment:

\documentclass[demo]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{subfig}
\usepackage{braket}
\usepackage{empheq}
\usepackage{animate}
%\usepackage[backend=biber,url=false,doi=false,isbn=false,firstinits=true]{biblatex}


\begin{document}

    \begin{frame}{Stuff}{More stuff}
\begin{overlayarea}{\textwidth}{.5\textheight}
        \begin{columns}[T]
        \begin{column}[T]{0.5\textwidth}
            \onslide<1>{
            \begin{itemize}
                \item text 1
                \item text 2
            \end{itemize} }
            \includegraphics<2>[width=\textwidth]{measurement_1.png}
            \includegraphics<3>[width=\textwidth]{measurement_2.png}
        \end{column}
        \begin{column}[T]{0.5\textwidth}
            \includegraphics<1-2>[width=\textwidth]{meas3.png}
            \includegraphics<3>[width=\textwidth]{meas4.png}
        \end{column}
        \end{columns}
\end{overlayarea}        
    \end{frame}


\end{document}

enter image description here

The demo class option simply replaces actual figures with black rectangles; do not use that option in your actual document.

Gonzalo Medina
  • 505,128
  • Ah, your answer may be better if the OP wants top-aligned. I went with \parbox from your answer here: http://tex.stackexchange.com/a/83691/32374 to center-align everything :-) – darthbith Mar 04 '15 at 21:23
  • hahahaha I was just reading that answer to understand the differences. I'm still a bit confused as to the difference but the answer @darthbith gaves work so I accepted. Gonzalo Medina, not sure if you can point to the differences/comparisons between the two answers. – evan54 Mar 04 '15 at 21:26
  • Also, another comment would be that ideally I'd like the second image to appear at the same height, I think that would mean a simple "only" instead of "onslide" correct? – evan54 Mar 04 '15 at 21:27
  • @evan54 to your question about \only: Yes. – Gonzalo Medina Mar 04 '15 at 21:28
  • @darthbith changing the height/width arguments in overlayarea one can get different vertical alignments in the frame. I edited my answer showing this with an example. – Gonzalo Medina Mar 04 '15 at 21:29
  • @GonzaloMedina But if you wanted to automatically center the text on the frame (vertically), you wouldn't be able to use the overlayarea, I don't think anyways. Nonetheless, one can certainly fine-tune the alignment with the height argument :-) – darthbith Mar 04 '15 at 21:35
  • @evan54 internally, overlayarea is a minipage inside a \vbox. The difference then is the same as between a \parbox and a minipage, for example, the behaviour with regard to footnotes. Other than this, they are essentially the same. – Gonzalo Medina Mar 04 '15 at 21:36
  • @darthbithYes. Using overlayarea there's no automatic vertical alignment to the center; the user has to fine-tune the parameters. – Gonzalo Medina Mar 04 '15 at 21:39
1

You can use a parbox. The command looks like \parbox[position][height][content position]{width}{text}. Note that:

  1. I don't have the images that you're using, so the height in the parbox is just a guess, adjust it to your needs (this is also why there's the demo option to the class)
  2. beamer already loads graphicx, no need to load it again
  3. When you make a MWE it is better to eliminate all of the packages that you load that don't lead to the error/problem you have. In particular, I can reproduce your problem while loading none of the packages you have in your preamble, so I deleted them all here :-)
  4. I made it so that everything would be centered vertically in the columns, because I assume you were using the [T] alignment due to the recommendation of the beamer manual. If you want top-alignment, simply put t in the appropriate optional arguments of the parbox

\documentclass[demo]{beamer}

\begin{document}
    \begin{frame}{Stuff}{More stuff}
        \begin{columns}
        \begin{column}{0.5\textwidth}
        \parbox[c][0.55\textheight][c]{\columnwidth}{
            \onslide<1>{
            \begin{itemize}
                \item text 1
                \item text 2
            \end{itemize} }
            \includegraphics<2>[width=\textwidth]{measurement_1.png}
            \includegraphics<3>[width=\textwidth]{measurement_2.png}
        }
        \end{column}
        \begin{column}{0.5\textwidth}
            \includegraphics<1-2>[width=\textwidth]{meas3.png}
            \includegraphics<3>[width=\textwidth]{meas4.png}
        \end{column}
        \end{columns}
    \end{frame}
\end{document}
darthbith
  • 7,384
  • thank you for the other tips as well, as you can tell I've just started using beamer, but it's great! – evan54 Mar 04 '15 at 21:21