TransWikia.com

Lualatex Tikz externalize error in scrartcle class

TeX - LaTeX Asked on March 8, 2021

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" "deftikzexternalre
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?

One Answer

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...

Answered by Raven on March 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP