I'm trying to create a composite figure in Latex, by layering two images (pngs) on top of each other with a text label added.
Sadly, this seem surprisingly difficult to achieve in LaTeX.
I tried the overpic package, but found it quite cumbersome: I don't want to have a base image on which to layer the others, since the coordinates are then wrong.
Tikz looks good and I can add images using:
\begin{figure}[hbtp]
\centering
\begin{tikzpicture}
\node at (0,0) {\includegraphics[width=.9\textwidth]{image1}};
\node at (0,0) {\includegraphics{image2}};
%\node at (0,0) {text}; doesn't work
\end{tikzpicture}
\end{figure}
However, the images are then put side by side, rather than overlayed. And I can't see how to add text at given coordinates either. The manual seemed quite confusing too, so if anyone has some recommended examples, or advice, it would be greatly appreciated please.
Thanks
Best Answer
Improved version
To have finer control, you can use
Caramdir's answer
to Drawing on an image with TikZ. The idea is to place the picture so that the lower left corner is at the origin of the TikZ coordinate system; a helper grid is added (SeeJake's answer
to the same question) just to easily visualize coordinates during the placement of other elements:First version
You can simply use the
overlay
option:Or name the first node and use the name to place the other elements: