如何让 tikzexternalize 与该论文模板一起工作?

如何让 tikzexternalize 与该论文模板一起工作?

我目前正在尝试获取此博士论文模板(http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ThesisStyle/) 与 tikzexternalize 合作,因为我有很多图片需要很长时间才能转换,我想尽可能地外包这项工作。我尽可能地缩小了范围,并构建了一个 MWE,可在此处访问:

https://www.dropbox.com/s/mlnhqvohbapqmej/MWE.zip?dl=0

只要图片(Chapter1/figs 中的 test.tikz)在第一页,代码就可以在 pdflatex 中正常运行,不会出错。一旦图片转到第二页(尝试取消注释 Chapter1/chapter1.tex 中的 \clearpage),我就会收到以下错误:

! Package tikz Error: Sorry, the system call 'pdflatex -shell-escape -halt-on-e
rror -interaction=batchmode -jobname "TikzFigs/thesis-figure0" "\def\tikzextern
alrealjob{thesis}\input{thesis}"' did NOT result in a usable output file 'TikzF
igs/thesis-figure0' (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 com
mand simply failed? Error messages can be found in 'TikzFigs/thesis-figure0.log
'. If you continue now, I'll try to typeset the picture.

这没什么帮助。该图的日志文件 (TikzFigs/thesis-figure0.log) 给出以下错误:

! Incomplete \iffalse; all text was ignored after line 12.
<inserted text> 
                \fi 
l.12 \end{tikzpicture}

我猜想这与模板类文件中使用的宏有关,但我无法确定问题是什么。有人有解决方案吗?

答案1

您可以尝试更改类文件中的此行(大约第 730 行):

\addtocontents{toc}{\protect\thispagestyle{empty}}

\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}}

相关内容