I am trying to externalize pgfplots, gnuplot and contour gnuplot in beamer. Towards this end I am using the visible on=<> facility of \usetikzlibrary{overlay-beamer-styles} (cf. this answer by user Daniel) as well as the automatic numbering solution from user Loop Space.

However I noticed a strange behaviour when I try to include \jobname in the filename by changing {#1-\overlaynumber} to {\jobname-#1-\overlaynumber}: when compiling the document the first time I get the following error message:

system returned with code 256
===== The last system call resulted in an EMPTY output file. 
Maybe it is part of \ref. Rescheduling it for \end{document}. ========

and the document is more or less empty. (this is not the case without \jobname). When I subsequently compile a the document multiple times it begins to include the images. Only after 4 compilations the document is complete. How to fix this bug?

MWE: (compile with pdflatex --shell-escape)

\usepackage{tikz, pgfplots}

%% automatic beamer numbering
  beamer externalizing/.style={%
    execute at end picture={%

\tikzset{every picture/.style={beamer externalizing}}
\tikzexternalize[only named=true]

    \addplot[visible on=<1-3>] {x};
    \addplot[visible on=<2-3>] {exp(x)};
    \addplot[visible on=<3-3>] {x*x};

    \addplot[visible on=<1-3>] gnuplot{x};
    \addplot[visible on=<2-3>] gnuplot{exp(x)};
    \addplot[visible on=<3-3>] gnuplot{x*x};

\begin{frame}{gnuplot contour}
  \begin{axis}[view={0}{90}, domain=-2:2]
    \addplot3[visible on=<1-3>,contour gnuplot={draw color=red,number=20, labels=false}] {x};
    \addplot3[visible on=<2-3>,contour gnuplot={draw color=blue,number=20, labels=false}] {y};
    \addplot3[visible on=<3-3>,contour gnuplot={draw color=black,number=20, labels=false}] {x^2+y^2};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.