使用 lualatex 和 tikzexternalize 编译带有 PGFPlots 的文档时出错

使用 lualatex 和 tikzexternalize 编译带有 PGFPlots 的文档时出错

我有一个相当大的文档,其中包含许多pgfplots图表,由于内存容量限制,PDFLaTeX我现在使用LuaLaTeX它来编译。虽然这种方法效果很好,但它takes forever to produce the document,所以我想将图表的编译外部化。我尝试过不同的方法,但似乎都不起作用。当我尝试编译一个最小示例时,例如

%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}

我收到以下错误:

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

只生成了一个 *.md5 文件。有人能告诉我我错在哪里吗?谢谢。

答案1

你是如何编译你的document.tex

事实证明,有些 latex 编辑器-shell-escape在编译时不会添加。如果您没有它(在命令行或您选择的 latex 编辑器中),请尝试使用lualatex -shell-escape document.tex

例如,在 TeXstudio 或 Texmaker 中,LuaLaTeX 命令必须从

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

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

相关内容