tikz/external:寫入檔案時出錯

tikz/external:寫入檔案時出錯

以下程式碼以前可以工作,但現在將輸出檔案寫入目標時遇到問題,這裡有什麼問題?

  • 嘗試過解決方案問題但沒用

命令:

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/}解決了問題。

相關內容