6

Consider the following code:

\begin{frame}{title}
    \hfill\includegraphics[width=7cm]{1.pdf}\hfill\hfill

    \vspace{2cm}

     \hfill\includegraphics[width=7cm]{2.pdf}\hfill\hfill
\end{frame}

This creates two slides: 1.pdf is shown on both, while 2.pdf is only shown on the second one. The problem is that when you move from the first slide to the second, 1.pdf jumps a little up, as if it is making room for 2.pdf (although there are plenty of room left for it!)

Here's a demonstration:

Image

You can get the source + PDF from here, and see it for yourself. (It is best to view the PDF in the full-screen mode.)

I tried absolute positioning of 1.pdf, using textpos (and a bunch of other techniques). However, this seems to be an overkill, and, moreover, placing the graphic at the center of the page (horizontally) seems hard.

Any suggestions?

2
  • Please don't use <pre> HTML tags for (La)TeX code, because it doesn't produce syntax highlighting. Indent the code by 4 spaces instead or use the '101010' button which does it for you. Please upload images using the official image provider imgur.com (using the image button) and include a your code as a minimal working example (MWE) into the question and not over an external website. Posts on TeX.SX should be selfcontained. Commented May 11, 2011 at 7:29
  • @Martin: Thank you very much. I didn't know that, but I'll promise to do it right next time. Commented May 11, 2011 at 10:06

2 Answers 2

6

Use the \visible<2>{...} macro to make the second image reserve space on the first slide to achieve correct alignment, but only be visible on the second slide. For text you can also use \uncover<2>{...} to achieve a semi-transparent effect (if configured), but it doesn't seem to have an effect on included images.

\documentclass[serif,xcolor=dvipsnames]{beamer}

\mode<presentation>
{
  \usetheme{Warsaw}
  \usecolortheme{default}
  \setbeamercovered{transparent}
  \setbeamertemplate{footline}[frame number]
}

\begin{document}

\begin{frame}[plain]
    \begin{center}
      \includegraphics[scale=.3]{1.png}

      \vspace{2cm}

      \visible<2>{\includegraphics[scale=.3]{2.png}}
    \end{center}
\end{frame}

\end{document}
2

I cannot see it. However, if you want to center the images use the environment center

\PassOptionsToPackage{demo}{graphicx}
\documentclass{beamer}

\begin{document}

\begin{frame}{Title}
\begin{overprint}
  \begin{center}
      \includegraphics[height=2cm]{1}

      \vspace{2cm}
      \onslide<2>{\includegraphics[height=2cm]{2}}
     \end{center}
  \end{overprint}
\end{frame}

\end{document}
3
  • Thanks for the answer. I think I must've miscommunicated myself, and I'm sorry for that. I changed the answer to include a screenshot, as well as a link to the TeX and PDF files. Please take a look at it. Commented May 11, 2011 at 7:09
  • @Sadeq: see edited answer
    – user2478
    Commented May 11, 2011 at 8:12
  • +1. Thank you. Both your answer and Martin's are exactly what I needed, and I had to flip a coin to accept one :( Commented May 11, 2011 at 10:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .