Typesetting material over each other is relatively easy without any extra packages by exploiting the \llap
and \rlap
TeX commands. These basically typeset some material from the current position to the left, respectively right, regardless what and without changing the current position.
As graphics included by \includegraphics
are aligned at the bottom, one additionally can use \raisebox
to lift the second graphics in y direction:
\documentclass{article}
\usepackage{lipsum}
\usepackage{graphicx}
\begin{document}
\lipsum[3]
\begin{figure}
\centering
\includegraphics[height=6cm]{example-image-a}%
\llap{\raisebox{3cm}{% move next graphics to top right corner
\includegraphics[height=3cm]{example-image-b}%
}}
\caption{My overlay figure.}
\end{figure}
\lipsum[3]
\end{document}
If one does not want to scale the first figure to a specific height, but to something like \columnwidth
, it is also possible to measure the resulting height. There are many ways to do this (which basically all results in: "box it" + "measure it") In the following, I simply use the functionality provided by the calc
package:
\documentclass{article}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{calc} % for height measuring
\begin{document}
\lipsum[3]
\begin{figure}
\centering
% first measure it's height (store in \dimen0), then actually include the graphics
\settototalheight{\dimen0}{\includegraphics[width=\columnwidth]{example-image-a}}%
\includegraphics[width=\columnwidth]{example-image-a}%
\llap{\raisebox{\dimen0-3cm}{% move next graphics to top right corner
\includegraphics[height=3cm]{example-image-b}%
}}
\caption{My overlay figure.}
\end{figure}
\lipsum[3]
\end{document}
picture
environment and place both images with\put
.figure
(environments) in apicture
environment? For example, this link (ursoswald.ch/LaTeXGraphics/picture/picture.html) doesn't talk about it, as doesn't the picture package documentation.figure
environment to use\includegraphics
. Place the wholepicture
environment in a singlefigure
environment if you want it to float.\includegraphics[height=4cm]{chart1.pdf}\llap{\raisebox{2cm}{\includegraphics[height=2cm]{chart2.pdf}}}
. You might have to play a bit with the numbers, height of chart2 + raise = height of chart1.