59

I'm trying to make a presentation using the Beamer class. I want to show a simple list of images, one by one in one frame, just like when you use itemize<+->.

I have no problem showing the images one-by-one, but the images shifts every time I insert a new image. How do I solve this - From my perspective there must be a simple solution, without specifying the absolute placement of the images.

aagaard
  • 1,596
  • 2
  • 14
  • 28
  • Would you like to show all the images in a single frame, or each image in its own frame, but aligned with the images shown before? – Sven Marnach Jan 13 '11 at 17:41
  • In a single frame... So the images do not shifts as they are uncovered – aagaard Jan 13 '11 at 18:05
  • 4
    You can find an entire community on the [TeX StackExchange](http://tex.stackexchange.com/), where no TeX-related question is too small. See [this question](http://tex.stackexchange.com/questions/7436/latex-beamer-fixed-vertical-alignment). – Matthew Leingang Jan 13 '11 at 18:38
  • Thanks for the link! I didn't know that existed. – aagaard Jan 13 '11 at 18:47

5 Answers5

55

You can simply specify a series of images like this:

\includegraphics<1>{A}
\includegraphics<2>{B}
\includegraphics<3>{C}

This will produce three slides with the images A to C in exactly the same position.

Svante
  • 50,694
  • 11
  • 78
  • 122
  • 5
    I also tried this with some success, but instead of "popping up", I would rather have the content allocated on the frame from the start. This is makes the other content on the slide move, when it appears. – aagaard Jan 13 '11 at 19:20
  • 1
    This one doesn't work if the images are individually wrapped in `centerline`. If they're all wrapped in a single `centerline` then it works. – kennyB May 28 '19 at 20:45
  • Put a % at the end of each line such that the images don't move (See Subhadeep's post below) – Mathi Feb 06 '23 at 01:56
51

I found a solution to my problem, by using the visble-command.

EDITED:

\visible<2->{
   \textbf{Some text}
   \begin{figure}[ht]
       \includegraphics[width=5cm]{./path/to/image}
    \end{figure}
 }
aagaard
  • 1,596
  • 2
  • 14
  • 28
  • `visible` is superior to `onslide` when it comes to figures, because `onslide` tries to transparentize a figure, but it cannot! – Sibbs Gambling Mar 13 '15 at 08:27
  • 3
    I think it is not needed to use \begin{figure} in most cases like this. You can just put the \includegraphics part, at least that is what I prefer. Do you intend to have numbered figures in a beamer slideshow? If yes, you are more fastidious than I :) – pauljohn32 Feb 05 '18 at 23:08
  • 1
    Nice solution, as space for figure will be taken into account in previous overlays, while it does not seem to be the case with the `\includegraphics<1>{A}` approach. Worth emphasising in your post? – Matifou Feb 10 '19 at 23:23
  • It worked perfectly for my case: 3 images with space between each other (\hfill-IMG1-\hfill-IMG2-\hfill-IMG3-\hfill). All the other solution makes the images move. – Chutlhu Nov 19 '20 at 10:19
23
\includegraphics<1>{A}%
\includegraphics<2>{B}%
\includegraphics<3>{C}%

The % is important. This will keep all the images fixed.

Andrew Myers
  • 2,754
  • 5
  • 32
  • 40
Subhadeep
  • 331
  • 2
  • 4
  • 2
    Shouldn't this be a comment to Svante's answer? – Cyriac Antony Jan 04 '20 at 08:28
  • 1
    I found the '%' essential for keeping the images fixed; is it a beamer-specific of latex-generic feature? – bricoletc Apr 28 '21 at 12:31
  • @bricoletc I suspect that this is LaTeX-wide. The percentage sign tries to get rid of an extra whitespace that would be there due to the newline character. In most situations the extra whitespace is helpful, e.g., mid-sentence line break. In this case it's a nuisance. – Frenzy Li Jul 30 '21 at 00:30
13

This is what I did:

\begin{frame}{series of images}
\begin{center}
\begin{overprint}

\only<2>{\includegraphics[scale=0.40]{image1.pdf}}
\hspace{-0.17em}\only<3>{\includegraphics[scale=0.40]{image2.pdf}}
\hspace{-0.34em}\only<4>{\includegraphics[scale=0.40]{image3.pdf}}
\hspace{-0.17em}\only<5>{\includegraphics[scale=0.40]{image4.pdf}}

\only<2-5>{\mbox{\structure{Figure:} something}}

\end{overprint}
\end{center}
\end{frame}
Kjuly
  • 34,476
  • 22
  • 104
  • 118
Amir
  • 131
  • 1
  • 2
1

This is a sample code I used to counter the problem.

\begin{frame}{Topic 1}
Topic of the figures
\begin{figure}
\captionsetup[subfloat]{position=top,labelformat=empty}
\only<1>{\subfloat[Fig. 1]{\includegraphics{figure1.jpg}}}
\only<2>{\subfloat[Fig. 2]{\includegraphics{figure2.jpg}}}
\only<3>{\subfloat[Fig. 3]{\includegraphics{figure3.jpg}}}
\end{figure}
\end{frame}
lionelmessi
  • 1,116
  • 2
  • 10
  • 17