TikZ External 和 tikzscale:每次都会重新生成图形

TikZ External 和 tikzscale:每次都会重新生成图形

我在模式下使用tikzscaletikz externallist and make在使用之前tikzscale,如果我发出make -f main.makefile命令,则只会生成不存在的图形。但是自从我开始使用以来tikzscale,所有图形都会重新生成,即使它们已经存在。这对于编写长文档来说需要大量时间。请仔细阅读 MWE,并让我知道我是否已正确设置了所有内容。

机器上的测试顺序linux是:

pdflatex main.tex
make -f main.makefile
ls -l main-figure0.pdf
make -f main.makefile
ls -l main-figure0.pdf

从时间戳可以看出,该图形是再次生成的。

平均能量损失

\documentclass{report}
\usepackage[showframe=true]{geometry}
\usepackage{filecontents,tikz}
\usetikzlibrary{external}
\tikzexternalize[mode=list and make]
%Comment out to external work properly without tikzscale
\usepackage{tikzscale}

\begin{filecontents}{fig.tikz}
   \begin{tikzpicture}
      \draw (0,0) rectangle (1,1);
   \end{tikzpicture}
\end{filecontents}

\begin{document}
  \begin{figure}
    \includegraphics[width=\textwidth]{fig.tikz}
    %Uncomment to see externalize work properly without tikzscale
    %\input{fig.tikz}
    \caption{Test figure}
  \end{figure}
\end{document}

答案1

这可能不是一个令人满意的答案,但是对于评论来说它太长了,而且它至少是一种解决方法。

我不建议使用mode=list and make,因为我看到的唯一真正优势(使用当前版本的外部库)是并行生成多个图形(对于文档作者本人而言,安全性方面应该可以忽略不计)。不幸的是,至少在 tikzscale 中,使用并行化时已经观察到竞争条件。因此,避免mode=list and make在实践中似乎没有任何缺点(当然,这可能会在未来发生变化),同时更舒适,因为 tex 可以自行完成所有工作。

也就是说,无论是否在使用 tikzscale mode=list and make(2012 年 12 月 26 日的 TikZ 安装),我的安装都会重新生成 main-figure0.pdf。如果您可以重现这种情况,这可能值得提交错误报告。使用默认模式时,如果文件未更改,则不会重新生成任何文件。我使用 tikzscale 0.2 版对此进行了测试,目前该版本似乎在 CTAN 上有点卡住了,但可以从以下位置下载github

Martin Scharrer 提到的上述问题也在 0.2 版本中得到修复。在 0.2 版本中,没有发现使用默认模式时会导致使用 extern 库进行不必要的再生(即在第一次 tex 运行之后)的情况。

相关内容