Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change an image on a slide in Latex?

Tags:

latex

beamer

In a frame I have two columns. In the first column I display some information using an itemize. When I display a new item I want to change in the second column the image which is displayed. I tried with onslide but it doesn't help me. Here is the code:

\begin{columns}
    \begin{column}[l]{10cm}
        \begin{itemize}[<+->]
            \item
                first item
            \item
                second item
        \end{itemize}
    \end{column}
    \begin{column}[r]{2cm}
        \onslide<1> 
        {
            \begin{figure}
                \includegraphics[width=2cm,height=3.5cm]{First.eps}
                \caption[1]{First Image}
            \end{figure}                
        }
        \onslide<2> 
        {
            \begin{figure}
                \includegraphics[width=2cm, height=3.5cm]{Second.eps}                   
                \caption[2]{Second Image}
            \end{figure}                
        }
    \end{column}
\end{columns}

Could you help me with this problem?

like image 522
Ionel Bratianu Avatar asked Jul 06 '09 19:07

Ionel Bratianu


People also ask

How do you insert a picture into a title slide in LaTeX?

You can add an image on the title slide in beamer using \titlegraphic{<image command>} . Its position is dependent on, i.e. defined by, the used theme.

How do I add a background image in beamer?

To change the background of one slide (or more) in Beamer, we put the command \setbeamertemplate{background} and frames between braces.

Can LaTeX make presentation slides?

Although there are several methods for making slide presentations in LaTeX, the beamer system is most widely used. With this system it's possible to make a presentation in just a few minutes.

How do you insert a video into a LaTeX presentation?

Videos can be embedded using Beamer's mutlimedia package. This can be done using the \movie tag in LaTeX. Options such as loop and autoplay are currently not supported. You can embed videos from your hard drive or from the web.


2 Answers

Try using \only instead of \onslide.

Otherwise you might want to try something like:

\begin{column}[r]{2cm}
    \begin{figure}
        \includegraphics<1>[width=2cm,height=3.5cm]{First.eps}
        \includegraphics<2>[width=2cm,height=3.5cm]{Second.eps}
        \caption<1>{First Image}
        \caption<2>{Second Image}
    \end{figure}                            
\end{column}

I hope this helps.

like image 186
Bjarke Freund-Hansen Avatar answered Oct 21 '22 04:10

Bjarke Freund-Hansen


Just as a small addition.

Instead of

\caption<1>{First Image}
\caption<2>{Second Image}

use

\caption{\only<1>{First Image}\only<2>{Second Image}}

This worked fine for me.

like image 21
leon Avatar answered Oct 21 '22 03:10

leon