# Joining different TikZ pictures

I want to draw a line from one part of the text (on the page) to another part. I'm storing (relative) coordinates, and this is the reason why my MWE doesn't work. Is there any way, using TikZ, of doing so? (Note that I wish to keep apart the TikZ pictures, i.e., I do not want to include the whole text in one TikZ picture environment.)

I have the following MWE:

\documentclass{article}
\usepackage{tikz}
\begin{document}
This is my text.\tikz\coordinate (one) at (0,0);

\bigskip\ldots\bigskip\bigskip

This is another text.\tikz{\coordinate (two) at (2,2); draw [red, thick, fill](one) --> (two);}
\end{document}


And this is, of course, what I get:

Update 1

According to the TikZ-PGF manual (p.249) I must use the remember picture and overlay options. This is the new code:

\documentclass{article}
\usepackage{tikz}
\begin{document}

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

\bigskip\ldots\bigskip\bigskip

This is another text.\tikz[remember picture] \node[fill=blue!50] (n2) {};

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

\end{document}


But it doesn't work either:

• Look up overlay picture – daleif Sep 28 '15 at 18:48
• You can do it with tikzmark. – Salim Bou Sep 28 '15 at 19:36
• Lacking backslash in front of draw – vaettchen Sep 28 '15 at 19:44

This is from the manual, adapted for your situation and using overlay as suggested by @daleif:

\documentclass{article}
\usepackage{tikz}

\begin{document}

Starting with a red dot,
\tikz[remember picture] \node[circle,fill=red!50] (n1) {};
we keep talking.

\bigskip\ldots\bigskip\bigskip

This is my text.
\tikz[remember picture] \node[fill=blue!50] (n2) {};
More to be said.

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

This is another text.

\end{document}


This yields

and hopefullly is good enough to get you started.