I'm having a hard time getting TikZ externalize and Forest to play nicely. Here is a MWE (text.tex
):
\documentclass{article}
\usepackage[external]{forest}
\tikzexternalize
\tikzset{
external/system call={
xelatex \tikzexternalcheckshellescape -halt-on-error -interaction=nonstopmode -jobname
"\image" "\texsource"
}
}
\begin{document}
\begin{forest}
[a
[b]
[c]
]
\end{forest}
\end{document}
I compile by invoking latexmk -xelatex -pvc test.tex --shell-escape
. The first time, everything works: I get a pdf output, and the tree is externalized as its own pdf. However, all subsequent compiles fail, with the following error:
! Argument of \tikzexternal@externalizefig@systemcall@uptodatecheck has an extra }.
<inserted text>
\par
l.17 \end{forest}
?
I'm using xelatex, but an identical error is present with a pdflatex compile.
The issue seems to be due to the interaction of Forest and TikZ: replacing the forest environment in the MWE with a tikzpicture environment fails to reproduce the error.
I'm using MacTeX-2015 and pgf version 3.0.0, along with the latest version of Forest (so says tlmgr). Thanks for any help you can offer.
EDIT (Addition by cfr)
I can reproduce the problem with the following minimal example
\documentclass{article}
\usepackage[external]{forest}
\tikzexternalize
\begin{document}
\begin{forest}
[a[b][c]]
\end{forest}
\end{document}
with pdflatex --shell-escape
on GNU/Linux with TeX Live 2015 updated a couple of hours ago.
The error on second compilation is:
(./prawf3.for)
! Argument of \tikzexternal@externalizefig@systemcall@uptodatecheck has an extr
a }.
<inserted text>
\par
l.13 \end{forest}
Gonzalo Medina can reproduce this.
forest
and externalisation with TikZ extensively. I have never once successfully externalised aforest
. I'm not saying it can't be done - clearly it is possible - but I decided it was not worth further energy trying to resolve the issues and just switch externalisation off forforest
environments. Note that I get multiple errors even if I don't run with shell escape so that it falls back to non-externalisation.forest
user manual suggests that it is possible (p.20), as you say, and prior threads on here indicate that it worked in principle, at least once upon a time (e.g.). Seems like a bug or incompatibility was introduced somewhere along the way, perhaps relatively recently.\usepackage{etex}
(which is necessary to work around an incompatibility between current TL and previous versions of forest). So I'm not sure that it can be that the bug has been reintroduced.... Unless my brain is the buggy bit.