I need to duplicate this image in many other slides. I want to avoid repeating the whole code again and again. Is there any way to force latex to compile the picture once and use it in many places?
Code: Select all
\usepackage{tikz}
\usepackage{tikz-timing}
\usepackage{tikz-qtree}
\usetikzlibrary{arrows,shapes,positioning,shadows,trees,scopes,snakes}
\begin{figure}[t]
\begin{center}
\begin{tikzpicture}[node distance=1cm,font=\scriptsize,
node/.style={circle,draw=brown!90,fill=orange!60,thick,inner sep=0pt,minimum size=6mm},
dummy/.style={node distance=1cm, rectangle,draw=blue!60,fill=blue!20,inner sep=0pt,minimum size=2mm}
]
\node[dummy] (D1) {};
\node[node,label={$\mu_i$,$r_{i1}$}] (J1) [left=of D1] {$i$};
\node[node,label={3,1}] (J2) [right=of D1] {2};
\node[node,label={1,4}] (J1) [above=of J2] {1};
\node[node,label={2,2}] (J3) [right=of J2] {3};
\node[dummy] (D2) [right=of J3]{};
\draw [->] (J2) to (J3);
\draw [->] (D1) to (J1);
\draw [->] (D1) to (J2);
\draw [->] (J3) to (D2);
\draw [->] (J1) to (D2);
\
\end{tikzpicture}
%\caption{\footnotesize An example project in which activity durations follow exponential distributions and resource availability equals five.}
\label{fig:Example}
\end{center}
\end{figure}