Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  Martin Scharrer May 11 '11 at 7:29
    
@Martin: Thank you very much. I didn't know that, but I'll promise to do it right next time. –  Sadeq Dousti May 11 '11 at 10:06
add comment

2 Answers

up vote 6 down vote accepted

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}
share|improve this answer
add comment

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}
share|improve this answer
    
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. –  Sadeq Dousti May 11 '11 at 7:09
    
@Sadeq: see edited answer –  Herbert May 11 '11 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 :( –  Sadeq Dousti May 11 '11 at 10:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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