0

I know similar questions have been asked in this forum and I've read many threads about it, but I cannot get it working like I want it to.

I have a slide with some text in the left column. Then I want to insert the first picture in the right (with a click) and after the next click I want the second picture appear in the same spot (right column) while the first one disappears.

Now I got that working with \visible but I get the problem that the text is moving downwards when clicking.

I tried \onslide and \only as well with different options like <1> and <1-> but neither worked out.

Here's some example:

\frame{ %
%
\frametitle{Frametitle}


\begin{columns}

  \begin{column}{0.5\textwidth}
    \textbf{bold text} \\
    \begin{itemize}
        \item text1
        \item text2
        \item an equation
    \end{itemize}
  \end{column}

\pause

  \begin{column}{0.5\textwidth}
      \begin{center}
          \visible<2>{
          \includegraphics<2>[width=.7\textwidth]{image1.png}
          } \pause
          %----
          \visible<3>{
          \includegraphics<3>[width=.7\textwidth]{image2.png}
          }
      \end{center}
  \end{column}

\end{columns}
}

Would appreciate your help - thanks!

1

Phuu, I finally got it... and I have multiple thoughts on this topic for anyone who gets into the same trouble.

First: if one doesn't need the figure to be too big, you can just adjust the parameters of the columns and the figuresize. When I used 0.65 for the graphics width, it did the job and I also modified the column sizes such that it doesn't quite add up to one (e.g. 0.35 and 0.6)
What I am taking out of that: Latex seems to be unable to put oversized boxes or environments correctly on a slide/page, that possibly exceed the boundaries of the text box.
Probably no proper latex-syntax talking, but I hope you get what I mean.

Second: As I did want the figure as large as possible, I used minipages like in this thread. I don't really like the somewhat redundant use of columns and minipages but it worked out.

It looks like this at the end:

\frame{ % Optik und Optomechanik
%
\frametitle{Optik und Optomechanik}


\begin{columns}

\onslide<1->{
\begin{column}[T]{0.45\textwidth}
    \begin{minipage}[c][.6\textheight][c]{\linewidth}
    \textbf{bold text} \\
    \begin{itemize}
        \item text1
        \item text2
        \item more text
    \end{itemize} 
    \end{minipage}}
\end{column}

\begin{column}[T]{0.65\textwidth}
    \begin{minipage}[c][.6\textheight][c]{1.1\linewidth}
    \centering{\includegraphics<2>[width=.7\textwidth]{image1.png}}%
    %----
    %\centering{\includegraphics<3>[width=.7\textwidth]{image1.png}} %if necessary
    \end{minipage}
\end{column}

\end{columns}
}

And of course, you can always mess around with the scales and sizes... Have fun!

  • I'm curious, what do you mean by "correctly" exactly? – Torbjørn T. May 9 '17 at 12:15
  • Good question. "Correctly" is definitely not the best word. I meant: it should rather ignore the boundaries of the textbox than squeeze oversize objects together... But of course one has to declare that... – Robert May 9 '17 at 13:44
1

An overlayarea can help - or you avoid the problem in the first place by using a top aligned frame with \begin{frame}[t].

\documentclass{beamer}

\begin{document}

\begin{frame}
    \frametitle{Frametitle}
    \begin{columns}[onlytextwidth,T]
        \begin{column}{0.48\textwidth}
            \textbf{bold text}\\
            \begin{itemize}
                \item text1
                \item text2
                \item an equation
            \end{itemize}
        \end{column}
        \begin{column}{0.48\textwidth}
            \begin{center}
                \begin{overlayarea}{\textwidth}{5cm}
                    \includegraphics<2>[width=.7\textwidth]{example-image-a}
                    \includegraphics<3>[width=.7\textwidth,height=5cm]{example-image-b}
                \end{overlayarea}
            \end{center}
        \end{column}
    \end{columns}
\end{frame}

\end{document}
  • Yep, that works as well, but poses the same problem, I described in my own answer: I cannot get the image as large as I'd like to. As for aligning the whole frame at the top: I think that doesn't look as good. – Robert May 9 '17 at 12:05
  • @Robert Did you try to adjust the value of 5cm to the height of your largest image? – user36296 May 9 '17 at 12:27
  • Yes, but that only changed the height without scaling the width correctly. I finally used the solution, I posted below. – Robert May 9 '17 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.