I am currently writing a document with a lot of plots. I draw them with pgfplots. which uses a lot of ressources. To manage that, I use the externalization feature of TikZ.
In the file myarticle.tex, there is:
\documentclass{article}
\usepackage{pgfplots}
\pgfrealjobname{myarticle}
\begin{document}
\begin{figure}[htbp]
\centering
\beginpgfgraphicnamed{myplot}
\begin{tikzpicture}
\begin{axis}
\addplot[mark=*,color=blue, solid] plot coordinates {
(0,0)
(0.5,1)
(1,2)
}; \label{myplotOne}
\end{axis}
\end{tikzpicture}
\endpgfgraphicnamed
\caption{A beautiful line: \ref{myplotOne}.}
\end{figure}
\end{document}
I then compile it with:
pdflatex --jobname myplot myarticle
pdflatex myarticle
pdflatex myarticle
Problem is it forbids me to use the label/ref mechanism of pgfplots. I know there is a remark about this on the pgfplots manual (section 4.4.2, page 30): "note that you can’t use the label/ref mechanism in conjunction with image externalization as this will (naturally) lead to undefined references."
Is there a way to trick LaTeX/TikZ in order to use them in conjunction? Maybe by storing the displayed reference in a pdf file?
-shell-escaperequired? Must this file be namedmyarticle.tex? This way also people which do not knowpgfplotsmuch but know a lot about references are able to help you. – Martin Scharrer Mar 01 '11 at 16:49