下面的代码以前可以工作,但现在无法将输出文件写入目标,这里的问题是什么?
- 尝试过的解决方案这问题,但不起作用
命令:
lualatex
--synctex=0
--shell-escape
--output-dir=.build
--interaction=nonstopmode
--file-line-error
main.tex
文件树:
主日志:
Package tikz Error: Sorry, the system call
'lualatex -shell-escape -halt-on-error -interaction=batchmode -jobname "./.build/figures/figure.0.0.0" "\def\tikzexternalrealjob{main}\input{main}"'
did NOT result in a usable output file
'./.build/figures/figure.0.0.0' (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 command simply failed?
Error messages can be found in './.build/figures/figure.0.0.0.log'.
If you continue now, I'll try to typeset the picture.
main.tex(MWE):
\documentclass{standalone}
% ========================= Tikz ========================= %
\usepackage{tikz}\usetikzlibrary{babel}
% ===================== External lib ===================== %
% \usepackage{shellesc} % Solution from similar question (doesnt work)
\usetikzlibrary{external}
\tikzsetfigurename{figure.\arabic{part}.\arabic{section}.} % set figure names
\tikzset{external/system call={%
lualatex \tikzexternalcheckshellescape
-halt-on-error
-interaction=batchmode
-jobname "\image" "\texsource"
% --jobname "\image" \subfilename
}}
\tikzexternalize[
up to date check={simple}, % faster check
figure list={true}, % generate list of figures file
prefix={./.build/figures/}
] % turn externalization on/off
% Fix background
\NewCommandCopy\oldtikzpicture\tikzpicture
\RenewDocumentCommand\tikzpicture{O{}}{\oldtikzpicture[#1]\nopagecolor}
\begin{document}
\tikzset{external/remake next=true}
\begin{tikzpicture}
\draw[->, thick, blue!60!]
( 0, 0)--node[anchor=south west]{\( A \)}
(-1,0.5);
\end{tikzpicture}
\end{document}
答案1
事实证明,\tikzsetexternalprefix{...}
启动时根文件已经位于.build
目录中,因此设置\tikzsetexternalprefix{./figures/}
解决了该问题。