# pgfplots externalize with hyperref

I'm using pgfplots with externalize because my document has a lot of plots which causes problems with memory limitation in LaTeX. In one of my plots I have a reference to an equation. In the file main-figure0.pdf the reference shows up correclty with the hypertext link from the hyperref package. But the hypertext link doesn't show up in the main.pdf file.

My MWE:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}

\usepgfplotslibrary{external}
\tikzexternalize[shell escape=-shell-escape]

\usepackage{hyperref}

\begin{document}
$$a=b \label{eq}$$
\ref{eq}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\node[draw, rectangle] (block) at (0,0) {\ref{eq}};
\end{tikzpicture}
\caption{test1}
\label{fig:test1}%
\end{figure}
\end{document}


I compile with:

pdflatex -shell-escape -synctex=1 -src-specials main.tex
pdflatex -shell-escape -jobname "main-figure0" "\def\tikzexternalrealjob{main}\input {main}"
pdflatex -shell-escape -synctex=1 -src-specials main.tex


How do I get the hypertext link to show up in the actual document?

-
If only one plot has that issue, you can disable the externalization for this one plot. –  T. Verron May 19 '14 at 16:00
I suppose importing hyperlinks by means of an external graphics is unsupported, sorry. Perhaps The comment of @T.Verron should become the answer. –  Christian Feuersänger May 20 '14 at 19:41
Thank you @T.Verron. I guess I can live with your solution although it's only some sort of workaround. Could you please make your comment to an answer? –  Pronk May 24 '14 at 14:30
Sorry for the delay. ;) –  T. Verron May 30 '14 at 10:52

As far as I know, tikz imports external graphics as pictures, just like what you would do with \includegraphics. Hypertext links are indeed dropped.
\tikzset{external/export next=false}