将 TikZ 外部化和草稿模式与 XeTeX 结合使用

将 TikZ 外部化和草稿模式与 XeTeX 结合使用

我尝试使用XeTeX 中的\tikzexternalize文档draft模式。

%% tikzext.tex
\documentclass[draft]{article}
\usepackage{xltxtra}
\defaultfontfeatures{Mapping=tex-text}
\usepackage{polyglossia}
\setdefaultlanguage[spelling=new]{german}

\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize

\begin{document}
\begin{tikzpicture}
    \draw (1,1) -- (2,2);
\end{tikzpicture}
\end{document}

我也尝试添加这行,因为我在另一份报告中看到了它 - 但不知道它们的作用是什么。

\tikzset{external/system call={%
    xelatex \tikzexternalcheckshellescape
    -halt-on-error -shell-escape -interaction=batchmode
-jobname "\image" "\texsource"}}

我从内部以这种方式调用我的 XeTeX vimxelatex -interaction=nonstopmode

这是产生的错误:

! 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'.
===== 'mode=convert with system call': Invoking 'xelatex -halt-on-error -intera
ction=batchmode -jobname "tikzext-figure0" "\def\tikzexternalrealjob{tikzext}\i
nput{tikzext}"' ========

! Package tikz Error: Sorry, the system call 'xelatex -halt-on-error -interacti
on=batchmode -jobname "tikzext-figure0" "\def\tikzexternalrealjob{tikzext}\inpu
t{tikzext}"' did NOT result in a usable output file 'tikzext-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 na
med 'write 18' or something like that. Or maybe the command simply failed? Erro
r messages can be found in 'tikzext-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.19 \end{tikzpicture}

[1] (./tikzext.aux) )
(see the transcript file for additional information)
Output written on tikzext.pdf (1 page).
Transcript written on tikzext.log.

我也尝试链接/usr/bin/md5/usr/bin/md5sum- 但没有效果。输出中提到的日志文件不存在。

答案1

在其他人的大力帮助下,这里找到了一个解决方案。

xelatex应该用 来调用-shell-escape。这会激活\write18。我不知道这是什么意思,但它确实有效。

请随意编辑此答案以添加更多技术细节。

相关内容