# How to place an “Export as PDF + Latex from Inkscape”-image above a \includegraphics image (overlay) - Make centers match

When you save images as a PDF, checking the PDF + Latex option, one gets 3 files:

• filename.pdf
• filename.pdf_tex
• filename.svg

If you'd like to include this exported image in a Tex document, this is fairly easy provided that the 3 files above are in the same folder as the Tex document you are working in, as follows:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\input{filename.pdf_tex}
\end{document}


Let's say we have another image titled "another-image.jpg". We could e.g. add it to the document by using \includegraphics{another-image.jpg}.

But, what if we would like to print the image from \input{filename.pdf_tex} right on top (overlay on) of \includegraphics{another-image.jpg}? How is that possible?

The following doesn't do the trick (it will just output the another-image next to the filename-image):

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{another-image.jpg}
\input{filename.pdf_tex}
\end{document}


Let's assume both of the images have equal relative dimensions, and one would like them scaled exactly the same, and put the center of the one right on top of the center of the other.

• just look at the generated _tex file it just a very thin shim that imports an image and then overlays some text by coordinates, you could just add the second image at a suitable place. – David Carlisle May 27 '16 at 6:50
• @DavidCarlisle How about including \usepackage{pst-node} and change \includegraphics{another-image.jpg} to \noindent\pnode{Center} \rput(Center){\includegraphics[width=\textwidth]{another-image.jpg}}? It as least puts the image from \input{filename.pdf_tex} on top of the another-image.jpg, even though it probably ends up in a corner where you don't want it. Could anybody make an answer from there? – Vincent Mia Edie Verheyen May 27 '16 at 6:54
• no need to load pstricks just for that, you could just use standard picture mode or even just \input{...}\llap{\includegraphics{...} – David Carlisle May 27 '16 at 6:58
• You certainly don't want to use pstricks together with jpg. Pstricks means latex + dvips and as they can't handle jpg this means additional work. – Ulrike Fischer May 27 '16 at 7:18

If one wants to have the images to be of width \linewidth, one can issue the following code in the main Tex document:

\documentclass{minimal}
\usepackage{graphicx, color}

\begin{document}
\def\svgwidth{\linewidth}
\input{filename.pdf_tex}
\end{document}


Then, one needs to adapt the code of the file filename.pdf_tex in e.g. the following manner:

• Look for the line of code that starts with \put(0,0){\includegraphics and which contains {filename.pdf}.
• Now, one can enter the following above that line of code:

\put(0,0){\includegraphics[width=\linewidth]{another-image.jpg}}

Then, one can always scale the images further jointly, and re-position them jointly in the main document; e.g. by issuing them within e.g. a parbox-, minipage- and/or figure-environment.