I have a figure that spans two columns in a two column document.

A minimal code example is given below.




\subfloat[Box A]{\label{f_a}\includegraphics[height=3cm]{example-image-a.png}}
\subfloat[Box B]{\label{f_b}\includegraphics[height=3cm]{example-image-b.png}}
\subfloat[Box C]{\label{f_c}\includegraphics[height=3cm]{example-image-c.png}}
\caption{Three boxes}



This produces a figure like enter image description here

I want to draw an arrow from one image to another without affecting the figure numbering or captions.

Desired result. enter image description here

How to achieve the desired result ?

  • Welcome to TeX.SX! Please complete the code fragment to a compilable document, including everything. Instead of your personal pictures, use the pictures included in TeX distributions with the mwe package, like example-image-a.png, such that everyone can copy the code and do experiments.
    – gernot
    Oct 12 '16 at 8:22
  • You need a combination of Drawing on an image with TikZ with the remember picture option of tikzpicture to access positions across pictures (for an example see e.g. texexample.net ).
    – gernot
    Oct 12 '16 at 8:28

To combine tikz elements with an image, one has to overlay it with a coordinate system. Copied from "Drawing on an image with TikZ":

  \node[anchor=south west,inner sep=0] (image) {\includegraphics{... name of image ...}};
  \begin{scope}[x={(image.south west)},y={(image.north east)}]
    ... tikz code, with (0,0) = south west and (1,1) = north east ...

To use positions across tikzpictures, one has to use the remember picture option. Moreover, the option overlay is necessary for those elements that connect the images; otherwise they would occupy space and influence the layout. Below is an example with two pictures and a connecting arrow (which I put into a separate picture).

\begin{tikzpicture}[remember picture]
  \node[anchor=south west,inner sep=0] (imageA) {\includegraphics[height=2cm]{example-image-a.png}};
  \begin{scope}[x={(imageA.south west)},y={(imageA.north east)}]
    \node[coordinate] (A) at (0.9,0.9) {};
\begin{tikzpicture}[remember picture]
  \node[anchor=south west,inner sep=0] (imageB) {\includegraphics[height=2cm]{example-image-b.png}};
  \begin{scope}[x={(imageB.south west)},y={(imageB.north east)}]
    \node[coordinate] (B) at (0.3,0.3) {};
\begin{tikzpicture}[remember picture,overlay]
  \draw[->] (A) -- (B);

enter image description here

  • Using the tikzpicture with remember picture inside subfloat solves the problem.
    – Naren
    Oct 12 '16 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.