# Build errors with tikz externalize

I am putting together a manuscript for submission to a journal. In a previous question I had asked about some spurious warnings, but I can live with those.

As a final step before submitting my manuscript, I used \tikzexternalize to produce separate figures that I could submit alongside my main Latex document. On the first build everything is fine, but on subsequent builds I get 1 error per figure...but the output is just fine. My concern is that the journal's submission guidelines say the text should compile without error, and they may not look past that.

I am using MikTex 2.9 and TeXnicCenter. I have run initexmf --edit-config-file=miktex\config\pdflatex.ini and added EnableWrite18=t

This MWE recreates the issue for a single figure. The data files can be found here and here

\documentclass{article}

\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usetikzlibrary{pgfplots.groupplots}
\usetikzlibrary{plotmarks}
\usetikzlibrary{patterns}
\usepgfplotslibrary{external}
\tikzexternalize

\pgfplotsset{compat = 1.12}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}
\begin{groupplot}[
group style={group size=2 by 1,
xlabels at=edge bottom,
ylabels at=edge left},
xlabel = {\footnotesize $\alpha_{++}$},
ylabel = {\footnotesize Departure Rate},
view={0}{90},
colorbar horizontal,
colorbar to name=ContourColorbar,
colormap/blackwhite,
y tick label style={/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=2,
/tikz/.cd},
x tick label style={/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=0,
/tikz/.cd}]
\nextgroupplot[title={\scriptsize Come and Go}]
\nextgroupplot[title={\scriptsize ++Resources}]
\end{groupplot}
\end{tikzpicture}
\ref{ContourColorbar}
\caption{++Resources and Come and Go}
\label{HeatMap}
\end{figure}

\end{document}


The error that is generated is

! Package tikz Error: Sorry, the system call 'pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "MWE -figure_crossref0" "\def\tikzexternalrealjob{MWE}\input{MWE}"' did NOT result in a usable output file 'MWE-figure_crossr ef0' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system calls. For pdflatex, this is 'p dflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed ? Error messages can be found in 'MWE-figure_crossref0.log'. If you continue now, I'll try to typeset the picture.

The figure comes out just fine

For the record, and at the risk of cross-posting, this MWE also generates the warning I referred to in the linked question above. That question remains unanswered, so if anyone can help me out there I'd appreciate it as well. The warning is

LaTeX Warning: Label ContourColorbar' multiply defined.

I have seen a number of other posts with titles that sound similar, but the accepted answers have done nothing for me...multiple MikTex installations, bibtex issues, etc.

Thanks!

• When submitting to journals I've always had to remove all tikz pictures and replace them with \includegraphics{tikzfigname} . Leaving in the tikz stuff just causes errors when using the journal's Latex (even if it doesn't on my computer). – Vermilion May 16 '15 at 7:35
• can you show us the content of MWE-figure_crossref0.log`? It should contain the root cause of the failure. – Christian Feuersänger May 16 '15 at 7:55
• With high probability, this issue is the one described in the TikZ manual, "50.4.1 Support for Labels and References In External Files" : these external references need extra steps during the externalization (described in that section) – Christian Feuersänger May 16 '15 at 7:58
• Forgive my naivety...it was probably too optimistic of me to stop reading at 3.2.6 in the pgfplots manual ! I will go find the reference you provided and see if I can figure it out.... – jerH May 16 '15 at 18:05
• I will add the contents of the log file to the original question. – jerH May 16 '15 at 18:06