我在 MacBook Pro Mid 2009 上使用最近更新的 MacTex Distribution 2016,Texmaker 是我的编辑器。我搜索了很长时间来寻找这个问题的解决方案,但没有什么真正有用的,所以我再试一次!我肯定错过了一些简单的东西,因为非常简单的 MWE 不起作用。
\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize
\begin{document}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false]
\addplot[domain=-2*pi:2*pi, samples=100]{cos(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}
当我在 pdflatex 上运行时
"pdflatex" --shell-escape -synctex=1 -interaction=nonstopmode %.tex
它运行起来非常好。但是当我运行 LuaLaTeX 时
"lualatex" --shell-escape -interaction=nonstopmode %.tex
它给出了错误:
! Package tikz Error: Sorry, the system call 'lualatex -shell-escape -halt-on-e
rror -interaction=batchmode -jobname "main-figure0" "\def\tikzexternalrealjob{m
ain}\input{main}"' did NOT result in a usable output file 'main-figure0' (expec
ted one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system c
alls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also name
d '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 t
ypeset the picture.
See the tikz package documentation for explanation.
这是为什么呢?提前致谢!
答案1
毫无疑问,软件包最终会更新至当前的 luatex,但在此之前:
\RequirePackage{luatex85,shellesc}
\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize
\begin{document}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false]
\addplot[domain=-2*pi:2*pi, samples=100]{cos(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}