# Error in compiling with Tikz Externalize

I've edited this post as I've broken the problem down to something smaller than a thesis. I can run the following command in the cmd window:

lualatex file.tex


with the following script no problem:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{float}
\usepackage[hang,small,bf]{caption}
\usepackage{color}

%\usetikzlibrary{external}
%\tikzexternalize

\begin{document}
The golden-crowned sifaka is a medium-sized lemur characterized by mostly white fur, prominent furry ears and a golden-orange crown.

\begin{figure}
\input{sdof.tex}
\caption{This is the caption}
\end{figure}

\begin{figure}
\input{strain.tikz}
\caption{This is the caption}
\end{figure}

\end{document}


But when I uncomment the

\usetikzlibrary{external}
\tikzexternalize


lines and use the following:

lualatex --shell-escape -interaction=nonstopmode file.tex


it compiles the first figure into file-figure0.pdf no problem but when it gets to teh second, there are problems and it gives a fatal error

sdof.tex is a simple diagram i drew myself in inkscape and the second strain.tikz is matlab2tikz output of lots of data points from a test.

• Does it work if you don't use a separate folder for the figures? Also, try with a folder name which does not contains the character _ (blind guess here). – JLDiaz Jun 30 '13 at 12:54
• Just tried both of those, unfortunately the same thing happens – Gerard Jun 30 '13 at 13:05
• The externalization requires quite a bit of 'magic' behind the scenes to work. I would try to approach it differently and start from a minimal example and not with a large document. Also did you have a look at t_figs/OReilly_Gerard_Thesis-figure2.log to check whether there is any hint to your problem? – Alexander Jun 30 '13 at 15:55
• Maybe you need lualatex to compile your second figure? Try this approach. – Juri Robl Jun 30 '13 at 16:11
• @Gerard Yes, by default it uses pdflatex for the external figures, because it was made for that. If you want to use it with another engine, you have to change it yourself. – Juri Robl Jun 30 '13 at 16:26

\usetikzlibrary{external}

• I appears as if lualatex does not support the underlying switch to auto-detect if shell-escape is active. Long words, short answer: you (may?) need to replace \tikzexternalcheckshellescape by -shell-escape. This is required if the images need external tools. – Christian Feuersänger Jul 1 '13 at 18:15