2

I have some plots created with TikZ and pgfplots. In the captions, I use \ref{...} with plot labels in order to get the marker printed there; a neat feature indeed.

Now, when submitting to arXiv one has to jump some hoops in order to make the document compile with their horribly outdated TeX Live (2011 at the time of this writing). In particular, I use TikZ externalization because TikZ has evolved a lot, and uplading the figure PDFs along with the LaTeX sources nicely circumvents problems.

The problem now is that said references to pgfplots plots resp. their labels fail to resolve; I get (??) instead of the marker. Needless to say the problem does not occur locally.

Is this something I can circumvent (short of hard-coding the marker there for arXiv), or do I have to live with it (i.e. hard-code the marker instead of using the reference mechanism)?

I don't give an MWE since I don't consider a fake submission to arXiv reasonable.

Raphael
  • 5,983

2 Answers2

3

The current (3.0.0) TikZ manual has this to say:

[\label in the externalized graphics which is referenced in the main document] is realized automatically by the external library. In detail, a \label inside of an externalized graphics causes the external library to generate separate auxiliary files for every external image. These files are called imagename.dpth. [...] When the main document loads the image, it will copy the .dpth file into the main .aux file.

So when you ship a document with external figures pre-prepared, you have to pack both PDF and dpth files.

Raphael
  • 5,983
2

Raphael's self-answer shows how to properly do that.


Unfortunately, we sometimes have to deal with systems that are (for questionable security reasons) restrictive in the types of files they allow to upload (e.g. “editorial manager” does not allow file names ending with .dpth) or use a prehistoric LaTeX version that does not have TikZ externalization altogether.

If you happen to be in such an unlucky situation, my following hack might save you trouble.

Assume you have an picture externalized to external.pdf with accompanying external.dpth. Rename external.dpth to external.tex and replace you TikZ picture with

\includegrapics{external}
\tikzexternalhack{external}

using the following definition in your preable:

\makeatletter
\newcommand\tikzexternalhack[1]{%
    \write\@auxout{\noexpand\input{#1}}%
}
\makeatother
Sebastian
  • 263