I am using the externalize feature of tikz/pgf to save space for my thesis. I am using TeXShop on a Mac. I am running into trouble referencing something in the main document from the externalized tikzpicture. A MWE for the main file:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
\usepackage{tikz}
\usepgfplotslibrary{external}
\tikzexternalize[prefix=pdfimages/]
\newcommand{\includetikz}[1]{%
\tikzsetnextfilename{#1}%
\input{#1.tex}%
}
\begin{document}
\begin{equation} \label{eq:equation}
y = x + x^2
\end{equation}
\includetikz{image}
\end{document}
A MWE for"image.tex":
\begin{tikzpicture}
\begin{axis}
\addplot [color=black,solid,line width=1.0pt,domain=0:1,samples=11]{x+x^2};
\addlegendentry{Eq. \ref{eq:equation}};
\end{axis}
\end{tikzpicture}
The pgfplots manual (Operations Mode in sec 7.1) suggests using mode=list and make to solve this issue, but I am having trouble understanding how to run the makefile that is generated. What would be a robust way of implementing this with TeXShop? Thanks for your help.
EDIT: Using make from the command line is the only way of doing this so far that has worked for me. I added mode=list and make to \tikzexternalize and then compiled it from TeXShop. Prompted by the compiler, running make -f main.makefile (main is the filename) generated the images. Compiled the document a few more times and the reference from within the graphic worked as promised.
This works but wasn't what I originally intended. If someone knows a way to this without the command line from within TeXShop, I would be much obliged.


