我需要使用 lualatex 来编译一些包含许多数据点(超过 可分配的内存pdflatex
)的 pgfplots。但是,当我尝试使用lualatex
外部库时,我在生成外部图形(.PDF)时遇到了问题。不过有趣的是,我可以使用 进行编译,pdflatex
而且,当我尝试使用 进行编译时lualatex
,通过将lualatex
外部命令复制到 LaTeX 项目根文档目录中的命令行中。我提供了一个最小的“工作”示例。
使用以下 .latexmkrc 文件将以下文件包含在同一目录中。我还想指出,在将选项传递-pdf
给 之前,不会读取/使用 .latexmkrc 文件latexmk
。即使我手动将 .latexmkrc 文件的位置传递给开关,情况也是如此-r
。这似乎是(不相关的)错误。
主文本
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[shell escape=-enable-write18]
\tikzset{external/system call={lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}
\begin{document}
\begin{figure}[h]
\input{tikz.tikz}
\end{figure}
\end{document}
tikz.tikz
\begin{tikzpicture}
\draw (0,0) circle [radius=.4];
\end{tikzpicture}
.latexmrc 文件
#$pdflatex = 'pdflatex -enable-write18 %O %S';
$pdflatex = 'lualatex --shell-escape -file-line-error --output-format=pdf %O %S';
日志文件的相关部分(存储错误的地方)
(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}]
(./main.aux))
(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
<c:/miktex2.9/fonts/opentype/public/lm/lmroman10-regular.otf>
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
为了强调,当我复制时
lualatex -enable-write18 -halt-on-error -interaction=batchmode -jobname "main-figure0" "\def\tikzexternalrealjob{main}\input{main}"
进入命令行,然后外部图形将按照期望/预期编译成PDF(和使用编译时一样pdflatex
)。
系统信息
操作系统:Windows 10,使用 64 位版本的 MiKTeX 2.9
perl:
perl --version
返回:This is perl 5, version 24, subversion 0 (v5.24.0) built for MSWin32-x64-multi-thread
lualatex:
lualatex --version
返回:This is LuaTeX, Version 1.0.4 (MiKTeX 2.9.6300 64-bit)
latexmk:
latexmk --version
返回:Latexmk, John Collins, 19 Jan. 2017. Version 4.52c
我认为 TikZ 版本并不重要。
答案1
如果是
lualatex
使用
shellesc
包裹。