# Align EPS graphics relative to point in EPS

I have several EPS (or SVG) graphics I would like to have in subfigures. The subfigures represent the same object throughout various stages. The width and height of the graphics are inconsistent. I want to align the subfigures to the same point in the EPS files. In the example below, I want the subfigures aligned at the M. The picture below show the unaligned subfigures.

The picture below shows how I want the figures aligned. Notice the distances between the Ms are the same.

I have tried manually defining a centre using TikZ, but it is inaccurate and a bit laborious. The real figures are a lot more complicated and can not simply be drawn in PGF/TikZ.

If there is no (simple) way of doing this in LaTeX, I am open for suggestions using InkScape, InDesign etc.

• I don't know how TikZ gets into this question but if so make M a node and then use [baseline=(M)] option on the tikzpicture. – percusse Apr 25 '18 at 9:40
• If your image is in PDF or EPS in any case the choice of the alignment point should be manual. If you want to "name" some alignment point, IMO, you will need to convert your images to something that LaTeX understand, like tikz. And you can't import (without conversion) directly SVG files. – Kpym Apr 25 '18 at 10:06

As percusse commented, baseline option allows you to align several tizpictures on an inner reference.

If node anchors are not enough good for your desired alignment (first example), you can always define a new coordinate to be used as reference (second example)

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\begin{tikzpicture}[baseline=(M.south)]
\node[draw](M){\includegraphics[width=3cm]{example-image}};
\end{tikzpicture}
\hfill
\begin{tikzpicture}[baseline=(M.center)]
\node[draw](M){\includegraphics[width=3cm]{example-image}};
\end{tikzpicture}
\hfill
\begin{tikzpicture}[baseline=(M.north)]
\node[draw](M){\includegraphics[width=3cm]{example-image}};
\end{tikzpicture}
\end{figure}

\begin{figure}
\begin{tikzpicture}[baseline=(aux)]
\node[draw](M){\includegraphics[width=3cm]{example-image}};
\fill[red] ([yshift=2mm]M.south) coordinate (aux) circle(2pt);
\end{tikzpicture}
\hfill
\begin{tikzpicture}[baseline=(aux)]
\node[draw](M){\includegraphics[width=3cm]{example-image}};
\fill[red] ([xshift=1cm]M.185) coordinate (aux) circle(2pt) ;
\end{tikzpicture}
\hfill
\begin{tikzpicture}[baseline=(aux)]
\node[draw](M){\includegraphics[width=3cm]{example-image}};
\fill[red] ([shift={(1cm,-.5cm)}]M.north) coordinate (aux) circle(2pt);
\end{tikzpicture}
\end{figure}
\end{document}