Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to know if we can reference a (tikz)picture within a node from another picture. In this way, I could create a PDF with multiple pictures which give details of each node from my first picture. Thanks.

share|improve this question
5  
Yes, that should be possible. However, we need some more details. Do you want to reference the figure number of the other tikzpicture or something else? In the first case simply but the picture into a figure environment and use \caption{<text>}\label{<label>} after it, but before the \end{figure}. Then you can reference it using \ref{<label>} from anywhere, including a node from another picture. This need two compiler run to get you stable output, BTW. –  Martin Scharrer Mar 26 '12 at 20:44
2  
Also please check the PGF/TikZ manual for [remember picture,overlay] options. Maybe your question is also related to that sort of referencing. As Martin mentioned if you can give a little more detail, we can have a better look. –  percusse Mar 27 '12 at 3:02
    
Thanks Martin, it's what I wanted to know. A question however, I used : \node[state] (A_1) [right of=A_0] {$A_1$ \ref{MyLabel}}; But a "1" appears and I wonder if we can apply the link on the node –  TTT Mar 27 '12 at 14:02

1 Answer 1

See section 16.13 Referencing Nodes Outside the Current Pictures in the TikZ/PGF-manual. It shows a nice example on how to do this.

I cite the relevant example below.


Inside the current text we place two pictures, containing nodes named n1 and n2, using

\tikz[remember picture] \node[circle,fill=red!50] (n1) {};

which yields (1), and

\tikz[remember picture] \node[fill=blue!50] (n2) {};

yielding the node (2). To connect these nodes, we create another picture using the overlay option and also the remember picture option.

\begin{tikzpicture}[remember picture,overlay]
\draw[->,very thick] (n1) -- (n2);
\end{tikzpicture}

In the manual you will see a line drawn from (1) to (2). I think that shows the possibilities and features of [remember picture,overlay] pretty well.

share|improve this answer
    
It's not what I was looking for but it's really interesting and good to know, thanks! –  TTT Mar 27 '12 at 14:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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