2

I have a fairly large document with a number of pgfplots diagrams and due to memory capacity limits in PDFLaTeX I am now using LuaLaTeX to compile. While this works well, it takes forever to produce the document, so I would like to externalise the compilation of the plots. I have tried different approaches, but none seem to work. When I try to compile a minimal example such as

%compiled using "../MiKTeX/miktex/bin/lualatex.exe" -enable-write18  %.tex
%using MiKTeX Portable, hence the ".../lualatex"

\documentclass[11pt]{minimal}

\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzset{external/system call={"../MiKTeX/miktex/bin/lualatex.exe" -enable-write18 -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}
\tikzexternalize

\pgfplotsset{compat=1.10}

\begin{document}

\begin{tikzpicture} 
    \begin{axis}[%
        xlabel=x, 
        ylabel=y] 
    \addplot[mark=x] coordinates {
        (2,-2)
        (3,-3)
        (4,-4)
        (5,-5)
    };
    \end{axis}
\end{tikzpicture}

\end{document}

I get the following error:

===== 'mode=convert with system call': Invoking '"../MiKTeX/miktex/bin/lualatex.
exe" -enable-write18 -halt-on-error -interaction=batchmode -jobname "MWE-figure0
" "\def\tikzexternalrealjob{MWE}\input{MWE}"' ========
runsystem("../MiKTeX/miktex/bin/lualatex.exe" -enable-write18 -halt-on-error -in
teraction=batchmode -jobname "MWE-figure0" "\def\tikzexternalrealjob{MWE}\input{
MWE}")...disabled.

! Package tikz Error: Sorry, the system call '"../MiKTeX/miktex/bin/lualatex.ex
e" -enable-write18 -halt-on-error -interaction=batchmode -jobname "MWE-figure0"
"\def\tikzexternalrealjob{MWE}\input{MWE}"' did NOT result in a usable output
file 'MWE-figure0' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that
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 comm
and simply failed? Error messages can be found in 'MWE-figure0.log'. If you con
tinue now, I'll try to typeset the picture.

And nothing but an *.md5 file is produced. Can anybody tell me where I am mistaken? Thanks.

Chaplin
  • 199
  • What does the log for the supplementary LaTeX run show? – Joseph Wright Apr 03 '14 at 15:11
  • @JosephWright I have edited the error message to include the system call. Other than that I do not know which log you mean. The MWE-figure0.log is not produced. – Chaplin Apr 03 '14 at 15:28
  • 2
    I got errors from the \pgfplotsset{compat=1.10}` but my pgf in miktex isn't quite uptodate. When I changed it to \pgfplotsset{compat=1.9} and used simply lualatex instead of your longer executable it worked fine. – Ulrike Fischer Apr 03 '14 at 15:29
  • So for me. With 1.10, too. – LaRiFaRi Apr 03 '14 at 15:43
  • Windows, TL2013: I commented out the line with tikzset and it is working for me. I also tried \tikzset{external/system call={"lualatex.exe" -shell-escape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}, it works for me. My next step would be to think about changing \image and \texsource, e.g. to ./\image or path-somewhere/\image. – Malipivo Apr 04 '14 at 06:10
  • It appears to be a problem of my editor (Texmaker 4.1.1) and not the above script itself. I have tried compiling it from the command line and it works. The same thing initialised by the editor, however, produces errors. – Chaplin Apr 07 '14 at 07:49
  • Could you please show the content of MWE-figure0.log? It contains the root cause of the failure. – Christian Feuersänger Jul 08 '14 at 08:53
  • I am afraid I cannot. Nothing but the MWE-figure0.md5 is created during compilation. I do however suspect, that the external system call my not be able to handle the relative path given in the \tikzset command. – Chaplin Jul 10 '14 at 12:00

1 Answers1

5

How did you compile your document.tex?

I turns out, that some latex editors do not add the -shell-escape when compiling. If you do not have it (in the command line, or the latex editor of your choice) try using lualatex -shell-escape document.tex.

For example, in TeXstudio or Texmaker the LuaLaTeX command has to be changed from

lualatex -synctex=1 -interaction=nonstopmode %.tex to

lualatex -shell-escape -synctex=1 -interaction=nonstopmode %.tex.

  • Welcome to TeX.sx! Based on the comments, the OP's editor is TeXmaker. – T. Verron Apr 28 '15 at 08:46
  • 1
    I just tested in in the portable version of TeXmaker and it is the same issue that can be resolved the same way. – Christian A. Hans Apr 28 '15 at 09:14
  • I can compile the document from the command line, if (and only if) the \tikzset command is removed. Configuring TeXmaker (which is indeed my editor) to use the suggested command does not resolve the issue. While the former is related to the pgf external library, the latter is probably caused by the configuration of my system (i.e. the combination of portable editions of both TeXmaker and MikTeX). Hence, I have accepted the answer since the remaining issue was not the primary focus of the question... – Chaplin Apr 29 '15 at 16:26
  • Thank you! Based on answers on another question, I was trying lualatex document.tex --shell-escape and lualatex document.tex --shell-escape with the same error always appearing. Turns out the order matters and -shell-escape has to come before the file. – iNyar Oct 26 '20 at 22:23