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.

I am trying to place an image on top of another in beamer. I am using

\documentclass[slidestop,compress,mathserif,12pt,xcolor=dvipsnames]{beamer}
\graphicspath{{images/}}
\definecolor{LHCblue}{RGB}{4, 114, 255}
\usecolortheme[named=LHCblue]{structure}
\usepackage[bars]{beamerthemetree} % Beamer theme v 2.2
\usepackage{kerkis}
\usepackage{multimedia}
\usepackage{subfigure}
\mode<presentation>
%frame
\newcommand*\oldmacro{}%
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
     \oldmacro\hfill%
  \insertframenumber\,}%/\,\inserttotalframenumber
\setbeamertemplate{footline}[frame number]
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\setbeamercovered{higly dynamic}
\usetheme[watermark=ntua-logo.jpg]{Ilmenau} % Beamer theme v 3.0
\useoutertheme[subsection=true]{smoothbars}%Beamer Outer Theme-circles on top

\useinnertheme{circles} %rectangle bullet points instead of circle ones
\usepackage{beamerthemebars}
\setbeamercolor{navigation symbols dimmed}{fg=red!80!black}
\setbeamercolor{navigation symbols}{fg=red!80!black}
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\title[July 2012 H4 Test Beam\hspace{3cm} Stony Brook, NYC]{July 2012 H4 Test Beam}
\author[Stamatopoulos N. Athanasios\hspace{2.5cm}{athanasios.stamatopoulos@cern.ch}]            {Stamatopoulos N. Athanasios}
\institute{NTUA/CERN}
\logo{%
  \makebox[0.99\paperwidth]{%
    \includegraphics[width=1cm,keepaspectratio]{cern_logo_white.jpg}%
    \hfill%
    \includegraphics[width=1cm,keepaspectratio]{ntua-logo.jpg}%
  }%
}

\usepackage{textpos}
\usepackage{tikz}
\usetikzlibrary{%
calc,%
fadings,%
shadings%
}

\usetikzlibrary{arrows,snakes,shapes}
%\usepackage{enumitem}
%\usepackage{paralist}

 \begin{document}

\begin{frame}
%\uncover<1->{\begin{figure}
%  \begin{center}
%    \includegraphics[width=10cm]{layers1}
%  \end{center} 
%\end{figure}}
%\hspace{-15cm}
%\uncover<2->{
%\begin{figure}
%  \begin{center}
%    \includegraphics[width=10cm]{layers}
%  \end{center} 
%\end{figure}}
\hspace{-15cm}
\begin{figure}
    \centering
    \uncover<1->{\includegraphics[width=10cm]{layers1}}%
    \llap{\raisebox{0cm}{%  move next graphics to top right corner
     \uncover<2->{ \includegraphics[width=10cm]{layers}}%
    }}
%    \caption{My overlay figure.}
  \end{figure}  
\end{frame}

\end{document}

I also tried using just the figure enviroment with \hspace{} between two images but it didn't work.{Code in comment}

share|improve this question
    
To clarify: by "on top of", you mean "above" rather than "superimposed on", right? –  Andrew Uzzell Sep 28 '12 at 6:51
    
I mean superimposed indeed! Please see uncover. The plan is to have the first image and then at the exact same position the socond one. –  Thanos Sep 28 '12 at 7:01
    
Sometimes the problem is in the graphics file. For example, the bounding box may be wrong. Have you tried something along the following lines (compile twice)? \documentclass{beamer} \usepackage{tikz} \begin{document} \begin{frame}[fragile] \begin{tikzpicture}[overlay,remember picture] \only<1>{\draw (current page.center) node[anchor=center] {stuff};} \only<2>{\draw (current page.center) node[anchor=center] {more stuff};} \end{tikzpicture} \end{frame} \end{document} –  Marc van Dongen Sep 28 '12 at 8:17
    
I used your code and it is working. I can tell the difference now. You are right! –  Thanos Sep 28 '12 at 9:18

1 Answer 1

up vote 6 down vote accepted

Do not use the figure environment, it makes no real sense in beamer

\PassOptionsToPackage{demo}{graphics}%% Delete it later
\documentclass{beamer}
\usepackage{caption}
\begin{document}
\begin{frame}{Titel}{Subtitle}
\centering
\includegraphics[height=0.35\textheight]{foo}
\captionof{figure}{first image}
\includegraphics[height=0.35\textheight]{bar}
\captionof{figure}{second image}
\end{frame}

\end{document}

enter image description here

and here the same as an overlay (on top of each other)

\PassOptionsToPackage{demo}{graphics}
\documentclass{beamer}
\usepackage{caption}
\begin{document}
\begin{frame}{Titel}{Subtitle}
\centering
\only<1>{\includegraphics[height=0.7\textheight]{foo}
\captionof{figure}{first image}}
\only<2>{\includegraphics[height=0.7\textheight]{bar}
\captionof{figure}{second image}}
\end{frame}

\end{document}

enter image description here

share|improve this answer
    
I don't mean that... I want them to be superimposed...Sorry for the inconvinience! –  Thanos Sep 28 '12 at 7:03
    
see edit, the second example –  Herbert Sep 28 '12 at 7:04
1  
If the images are not the same size, you will need to use an `overlayarea1 to avoid the rest of the content 'jumping around'. –  Joseph Wright Sep 28 '12 at 7:06
    
@Joseph: not when I controll the height of the image instead of the width –  Herbert Sep 28 '12 at 7:08
1  
@Thanos: the center environment adds some vertical white space before and after. And this is especially in the limited height of a slide not a good option. \centering doesn't –  Herbert Sep 28 '12 at 7:32

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.