I need to use lualatex to compile some pgfplots which have many data points (exceeding the memory allocatable by pdflatex). However, when I try using lualatex with the external library I'm having issues generating the external graphics (.PDFs). Interestingly, though, I can compile with pdflatex and also, when I try compiling with lualatex, by copying the lualatex external command into the command line in the directory of the root document of the LaTeX project. I've included a minimum "working" example.

The below files are included in the same directory using the following .latexmkrc file. I'd also like to note that the .latexmkrc file isn't read/used until I pass the -pdf option to latexmk. This is true even if I pass the location of the .latexmkrc file to the -r switch manually. This seems like (an unrelated) bug.


\tikzexternalize[shell escape=-enable-write18]
\tikzset{external/system call={lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}



  \draw (0,0) circle [radius=.4];

.latexmrc file

#$pdflatex = 'pdflatex -enable-write18 %O %S';
$pdflatex = 'lualatex --shell-escape -file-line-error --output-format=pdf %O %S';

Relevant portion of log file (where error is stored)

(C:/Miktex2.9/tex/generic/oberdiek/etexcmds.sty)))) (./tikz.tikz
===== 'mode=convert with system call': Invoking 'lualatex -enable-write18 -halt
-on-error -interaction=batchmode -jobname "main-figure0" "\def\tikzexternalreal
job{main}\input{main}"' ========
lualatex -enable-write18 -halt-on-error -interaction=batchmode -jobname "main-f
igure0" "\def\tikzexternalrealjob{main}\input{main}"

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

See the tikz package documentation for explanation.
Type  H <return>  for immediate help.

l.3 \end{tikzpicture}

) [1{C:/Users/JohnRinehart/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]
(see the transcript file for additional information)
 353 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 2 glue, 3 attribute, 45 glue_spec, 3 attribute_lis
t, 1 write nodes
   avail lists: 2:83,3:21,4:7,5:22,6:2,7:33,8:1,9:14
Output written on main.pdf (1 page, 3073 bytes).
SyncTeX written on main.synctex.gz.
Transcript written on main.log.
=== TeX engine is 'LuaTeX'
Latexmk: Errors, so I did not complete making targets

For emphasis, when I copy

lualatex -enable-write18 -halt-on-error -interaction=batchmode -jobname "main-figure0" "\def\tikzexternalrealjob{main}\input{main}"

into the command line then the external graphic is compiled into a PDF as desired/expected (and as works when compiling with pdflatex).

System Information

  • OS: Windows 10 using a 64-bit release of MiKTeX 2.9

  • perl: perl --version returns: This is perl 5, version 24, subversion 0 (v5.24.0) built for MSWin32-x64-multi-thread

  • lualatex: lualatex --version returns: This is LuaTeX, Version 1.0.4 (MiKTeX 2.9.6300 64-bit)

  • latexmk: latexmk --version returns: Latexmk, John Collins, 19 Jan. 2017. Version 4.52c

I don't think the TikZ version matters.

1 Answer 1


In the case of





  • I see that you have received my email :). Thank you for your prompt assistance. I will try this, now. May 12, 2017 at 22:04
  • That fixed my issue immediately. Thank you. May 12, 2017 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.