# Example: Global nodes

Published 2006-11-08 | Author: Kjell Magne Fauske

With version 1.09 or later of PGF/TikZ, it is possible to access nodes in other pictures. This is a very useful feature for presentations, posters and such. The catch is that it only works with pdfTeX and requires you to run TeX twice.

Author: Kjell Magne Fauske

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de. En français: TeXnique.fr.

\documentclass{article}

\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{arrows}
\begin{document}
\pagestyle{empty}

% For every picture that defines or uses external nodes, you'll have to
% apply the 'remember picture' style. To avoid some typing, we'll apply
% the style to all pictures.
\tikzstyle{every picture}+=[remember picture]

% By default all math in TikZ nodes are set in inline mode. Change this to
% displaystyle so that we don't get small fractions.
\everymath{\displaystyle}

\begin{itemize}
\item Coriolis acceleration
\tikz\node [fill=blue!20,draw,circle] (n1) {};
\end{itemize}

% Below we mix an ordinary equation with TikZ nodes. Note that we have to
% adjust the baseline of the nodes to get proper alignment with the rest of
% the equation.
\begin{equation}
\vec{a}_p = \vec{a}_o+\frac{{}^bd^2}{dt^2}\vec{r} +
\tikz[baseline]{
\node[fill=blue!20,anchor=base] (t1)
{$2\vec{\omega}_{ib}\times\frac{{}^bd}{dt}\vec{r}$};
} +
\tikz[baseline]{
\node[fill=red!20,anchor=base] (t2)
{$\vec{\alpha}_{ib}\times\vec{r}$};
} +
\tikz[baseline]{
\node[fill=green!20,anchor=base] (t3)
{$\vec{\omega}_{ib}\times(\vec{\omega}_{ib}\times\vec{r})$};
}
\end{equation}

\begin{itemize}
\item Transversal acceleration
\tikz\node [fill=red!20,draw,circle] (n2) {};
\item Centripetal acceleration
\tikz\node [fill=green!20,draw,circle] (n3) {};
\end{itemize}

% Now it's time to draw some edges between the global nodes. Note that we
% have to apply the 'overlay' style.
\begin{tikzpicture}[overlay]
\path[->] (n1) edge [bend left] (t1);
\path[->] (n2) edge [bend right] (t2);
\path[->] (n3) edge [out=0, in=-90] (t3);
\end{tikzpicture}

\end{document} 