2

I want to copy part of a relatively complex tikz figure (with an image in the background and text above) to another tikz figure on another page.

I'm thinking of using spy, but I haven't found an example of how to copy to another figure.

2

This is just to confirm that you can, in principle, use spy for that. (Unfortunately your question is a bit vague so I just add a random example from section 73 Spy Library: Magnifying Parts of Pictures of the pgfmanual. There are many ways in which one can improve this, but this requires a bit more concrete input from your side, I am afraid.)

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{decorations.fractals,spy} 
\makeatletter
\tikzset{save spy as/.style={execute at end scope={%
\global\setbox#1\copy\tikz@lib@spybox
}}}
\makeatother
\newbox\mybox
\begin{document}
\begin{tikzpicture}[spy using outlines={circle, magnification=4, size=2cm, connect spies},
save spy as=\mybox]
\draw [help lines] (0,0) grid (3,2);
\draw [decoration=Koch curve type 1]
decorate { decorate{ decorate{ decorate{ (0,0) -- (2,0) }}}};
\spy [red] on (1.6,0.3)
in node [left] at (3.5,-1.25);
\spy [blue, size=1cm] on (1,1)
in node [right] at (0,-1.25);
\end{tikzpicture}
\begin{tikzpicture}
\node{\usebox\mybox};
\path (3,2);
\end{tikzpicture}
\end{document}

enter image description here

Presumably one could also just use layers.

1
  • Merci, c'est exactement ça! – rpapa May 31 '20 at 8:20

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.