![当 Tikzpictures 已经在文档中时,如何将其外部化?](https://linux22.com/image/340042/%E5%BD%93%20Tikzpictures%20%E5%B7%B2%E7%BB%8F%E5%9C%A8%E6%96%87%E6%A1%A3%E4%B8%AD%E6%97%B6%EF%BC%8C%E5%A6%82%E4%BD%95%E5%B0%86%E5%85%B6%E5%A4%96%E9%83%A8%E5%8C%96%EF%BC%9F.png)
我有一个很大的(而且会非常大)文档,需要很长时间才能编译。我怀疑处理几个图tikz
需要太长时间。所以我昨天所做的就是放入以下代码片段:
\usetikzlibrary{external}
\tikzexternalize[prefix=figures/] % Where I want the pictures to be output under this folder.
我得到了一个错误,无法找到我的第一个图形(由 创建)的 MD5 tikzpicture
。经过几个小时的反复试验,我设法让我的 TeX Studio 编译,并发出一个外部用户命令
"/texlive/bin/win32/xelatex.exe" -synctex=1 -interaction=nonstopmode --shell-escape %.tex
它可以编译,但不知何故我收到了 XeLaTeX 无法将图片输出为任何正确格式的错误。
平均能量损失
(此段已删除,见历史记录)
我设法获得了一个仍然存在错误的 MWE。在这个 MWE 中,我首先在没有代码片段的情况下进行了编译。然后输入这样的代码并重新编译它。
\documentclass[12pt,a4paper]{scrbook}
\usepackage[usenames,dvipsnames,svgnames,x11names]{xcolor}
\usepackage{caption}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{external}
\tikzexternalize[prefix=figures/] % Where I want the pictures to be output under this folder.
\begin{document}
\chapter{Sample}
\begin{figure}[h!]
\centering
\begin{tikzpicture}[
block/.style={%
rectangle,minimum size=6mm,very thick,draw=Tomato!95!Grey!25!
}]
\node (start) [block] {A};
\node (interim) [block,right=of start] {B};
\node (end) [block,right=of interim] {C};
\path (start) edge[->] (interim)
(interim) edge[->] (end);
\end{tikzpicture}
\caption{some caption}
\label{fig:A}
\end{figure}
\end{document}
错误提示:
! Package tikz Warning: The key 'up to date check=md5' is impossible, there is no macro to compute MD5. Falling back to 'up to date check=diff'.
! I can't write on file `figures/main-figure0.md5'.
<to be read again>
\relax
l.53 \end{tikzpicture}
(Press Enter to retry, or Control-Z to exit; default file extension is `.tex')
Please type another output file name
! Emergency stop.
<to be read again>
\relax
l.53 \end{tikzpicture}
*** (job aborted, file error in nonstop mode)
创建目录后,根据 cfr 的建议,删除 .aux 和 .auxlock 文件。然后会出现一个扩展警告 + 错误消息:
! Package tikz Warning: The key 'up to date check=md5' is impossible, there is no macro to compute MD5. Falling back to 'up to date check=diff'.
'xelatex' is not recognized as an internal or external command, operable program or batch file.
===== 'mode=convert with system call': Invoking 'xelatex -shell-escape -halt-on -error -interaction=batchmode -jobname "figures/PHYSnotes-figure0" \def\tikzexternalrealjob{PHYSnotes}\input{PHYSnotes}"' ========
! Package tikz Error: Sorry, the system call 'xelatex -shell-escape -halt-on-error -interaction=batchmode -jobname "figures/main-figure0" "\def\tikzexternalrealjob{main}\input{main}"' did NOT result in a usable output file 'figures/main-figure0' (expected one of .pdf:.jpg:.jpeg:.png:.bmp:). 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 'figures/main-figure0.log'. If you continue now, I'll try to typeset the picture.
此外,我正在使用
- TeX Live 2016
- 最新更新的 TeX Studio 便携版(我两周前下载的)
- XeLaTeX 作为编译方法