0

Consider the following MWE:

\documentclass{scrartcl}

\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize
\tikzset{external/system call={lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}

\begin{document}
    \begin{tikzpicture}
        \draw (0,0) -- ++(2,2);
    \end{tikzpicture}
\end{document}

When compiling this with lualatex -shell-escape externalizeTest.tex, it results in the error (in my case the file is named externalizeTest.tex)

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

If however I change the documentclass to standalone, everything works like charm.

The same applies if I use pdflatex instead of lualatex to compile the document.

Does anyone know what's going on here?

1 Answer 1

0

Now even though I don't know why this happens, I have found a solution to the problem (see also Cannot run tikz externalize with lualatex but it used to work):

If I also include the shellesc package, the document compiles just fine with lualatex as well (with the scrartcle class). The MWE then looks like this:

\documentclass{scrartcl}

\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize
\tikzset{external/system call={lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}
\usepackage{shellesc}

\begin{document}
    \begin{tikzpicture}
        \draw (0,0) -- ++(2,2);
    \end{tikzpicture}
\end{document}

Now I think that I have read once that lualatex handles shell-escaping differently than pdflatex and thus one has to include the shellesc package in order to make it compatible with "the normal way" of doing it.

As to why it worked with standalone, my best guess would be that this class implicitly includes the shellesc package. I don't actually have proof of this though.

If someone knows what's actually going on, it'd be great if you could comment or even write an answer of your own...

2
  • 1
    You can easily check if standalone loads shellesc: look in the log-file. Beside this your example works fine in current texlive even without shellesc, imho tikz adapted the calls at some time. Commented May 3, 2020 at 10:04
  • @UlrikeFischer ah that's good to know. Thank you :)
    – Raven
    Commented May 3, 2020 at 10:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .