2

I have two figures (.pdf) side-by-side and would like to draw an arrow from the right one to the left one, with the arrow head ending at a specific location in the left figure. Here is a MWE:

\documentclass{scrartcl}

\usepackage{tikz}

\begin{document}
\begin{figure}[htbp]
  \tikz[remember picture]{\node(figleft){\framebox{\parbox[c][3cm]{0.4\textwidth}{\hspace{3.5cm}\raisebox{2cm}{Figure 1}}}};}%
  \hfill
  \raisebox{10mm}{\tikz[remember picture]{\node(figright){\framebox[0.4\textwidth]{Figure 2}};}}%
  \tikz[overlay, remember picture]{\draw[thick, stealth-] (figleft-|figleft.north) -- (figright-|figright.west);}
\end{figure}
\end{document}

The arrow head should end at a specific location inside Figure 1 (say, where the text "Figure 1" appears). I assume I'd need to somehow specify the location of the node figleft. A crude idea was to place a node at the location of "Figure 1" and then have the arrow drawn to that location. I tried with \tikz[remember picture]{\node at (-1cm,3cm) (anchor) {Anchor};} but the placement (-1cm, 3cm) didn't seem to be respected.

1
  • I think the question might benefit from adding a screenshot of the output of the MWE. Feb 13 at 1:35

1 Answer 1

5

It seems odd to put \framebox inside a node when almost the exact same thing is achieved by [draw]. The only difference is [inner sep] vs. \fboxsep. Also (figleft-|figleft.north) is equivalent to simply (figleft.north) etc.

More importantly, \raisebox raises the text by lowering the baseline. So [baseline=-10mm] is equivalent to \rasiebox{10mm){...}. Similarly, Figure 1 is 2cm above (figleft.base).

\documentclass{scrartcl}

\usepackage{tikz}

\begin{document}
\begin{figure}[htbp]
  \tikz[remember picture]{\node[draw,minimum height=3cm,minimum width=0.4\textwidth](figleft){\hspace{3.5cm}\raisebox{2cm}{Figure 1}};}%
  \hfill
  \tikz[remember picture, baseline=-10mm]{\node[draw,minimum width=0.4\textwidth,anchor=south](figright){Figure 2};}
  \tikz[overlay, remember picture]{\draw[thick, stealth-] (figleft.base east) ++ (0,2) -- (figright.west);}
\end{figure}
\end{document}

demo

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.