I've read a bunch of questions and answers on these topics as well as the documentation of the external
library for tikz
. I suspect I fundamentally misunderstand what I'm doing.
I have a mindmap which I'm including in a beamer
presentation. It takes forever to compile so I would like to externalise it using the external
library. I am also using overlay specifications to gradually make parts of the map visible. The mindmap is prepared in a separate file which I \input
with the facilities of standalone
.
Without externalisation, my code produces the slides OK. With externalisation, it fails.
This is a Minimal Non-Working Example using beamer
, external
and standalone
. The beamer presentation is in prawf3.tex
:
\documentclass{beamer}
\usepackage{standalone}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize
\makeatletter
\tikzset{% https://tex.stackexchange.com/a/79572/39222
beamer externalising/.style={%
execute at end picture={%
\tikzifexternalizing{%
\ifbeamer@anotherslide
\pgfexternalstorecommand{\string\global\string\beamer@anotherslidetrue}%
\fi
}{}%
}%
},
external/optimize=false
}
\makeatother
\begin{document}
\begin{frame}{A frame}
\input{prawf3-pic}
\end{frame}
\end{document}
prawf3-pic.tex
is as follows:
\documentclass[11pt,tikz]{standalone}
\begin{document}
\begin{frame}{A frame}
\begin{tikzpicture}[beamer externalising]
\node (a) {A};
\only<2->
\node (b) at (0,1) {B};
\end{tikzpicture}
\end{frame}
\end{document}
[Obviously, prawf3-pic.tex
will not compile on its own as it stands because beamer externalising
is not defined in that case. This isn't the problem.]
The code for the beamer externalising
style is from Andrew Stacey's answer to a somewhat similar question which lacked the standalone
element.
When I try to compile prawf3.tex
using pdflatex -shell-escape
, the compilation fails with
! Package tikz Error: Sorry, the system call 'pdflatex -shell-escape -halt-on-e
rror -interaction=batchmode -jobname "prawf3-figure0" "\def\tikzexternalrealjob
{prawf3}\input{prawf3}"' did NOT result in a usable output file 'prawf3-figure0
' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled
system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is a
lso named 'write 18' or something like that. Or maybe the command simply failed
? Error messages can be found in 'prawf3-figure0.log'. If you continue now, I'l
l try to typeset the picture.
but obviously shell escape is enabled as the error itself makes clear.
prawf3-figure0.log
includes this just before it gives up with a Fatal error
message:
LaTeX Info: Redefining \includegraphics on input line 21.
No file prawf3-figure0.nav.
(./prawf3-pic.tex
\openout5 = `prawf3-figure0.dpth'.
Missing character: There is no ( in font nullfont!
Missing character: There is no b in font nullfont!
Missing character: There is no ) in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no ( in font nullfont!
Missing character: There is no 0 in font nullfont!
Missing character: There is no , in font nullfont!
Missing character: There is no 1 in font nullfont!
Missing character: There is no ) in font nullfont!
Missing character: There is no B in font nullfont!
Missing character: There is no ; in font nullfont!
[1
\providecommand \oddpage@label [2]{}
{/usr/local/texlive/2013/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
! Extra }, or forgotten \endgroup.
\endframe ->\egroup
\begingroup \def \@currenvir {frame}
l.27 \end{frame}
I tried using {}
with \only<2->
:
{\node (b) at (0,1) {B};}
but that did not help. (This isn't surprising but it seemed worth trying as it was about the only thing I could think to try.)
Note that I think the complaints about the nullfont
are unrelated as I get these with the full example even though everything compiles fine.
EDIT
I'm even more confused now as it turns out that it is not even sufficient to disable externalisation as follows:
\documentclass{beamer}
\usepackage{standalone}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize
\tikzexternaldisable
\makeatletter
\tikzset{% https://tex.stackexchange.com/a/79572/39222
beamer externalising/.style={%
execute at end picture={%
\tikzifexternalizing{%
\ifbeamer@anotherslide
\pgfexternalstorecommand{\string\global\string\beamer@anotherslidetrue}%
\fi
}{}%
}%
},
external/optimize=false
}
\makeatother
\begin{document}
\begin{frame}{A frame}
\input{prawf3-pic}
\end{frame}
\end{document}
I thought that disabling externalisation would be sufficient to get compilation since it essentially turns the externalisation off. And beamer externalising
seems to be defined conditionally so that it should be innocuous enough in that case…
Best Answer
This version works for me (and is shorter in code).
No need for
standalone
. That answer should be possible updated, although my score is yet too low to do that.If you want full automatization, you would need a counter inside.
prawf3.tex
prawf3-pic.tex