TikZ 外部化选项导致编译错误

TikZ 外部化选项导致编译错误

正如标题所述,externalize 选项会导致一些我无法理解的奇怪错误。它适用于某些图形(例如,我在 pgfplots 手册中找到的代码的图形),但对于使用 matlab2tikz 生成的其他一些图形,如果激活了 externalize 选项,我会收到一些奇怪的错误。

例如如果我的文档看起来像

\documentclass[12pt]{standalone}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{external}
\tikzexternalize[prefix=figures/]

\begin{document}

\begin{tikzpicture}
\pgfplotsset{every axis/.append style={line width=0.5pt}}

\begin{axis}[%
view={0}{90},
width=4in,
height=3in,
scale only axis,
xmin=0, xmax=6.28318530717959,
ymin=-0.999874127673875, ymax=0.999874127673875,
outer axis line style={line width=0.8pt},
grid style={densely dashed}]
\addplot [
color=blue,
solid
]
coordinates{
 (0,0)(0.0634665182543393,0.0634239196565645)(0.126933036508679,0.126592453573749)(0.190399554763018,0.18925124436041)(0.253866073017357,0.251147987181079)(0.317332591271696,0.312033445698487)(0.380799109526036,0.371662455660328)(0.444265627780375,0.429794912089172)(0.507732146034714,0.486196736100469)(0.571198664289053,0.540640817455598)(0.634665182543393,0.59290792905464)(0.698131700797732,0.642787609686539)(0.761598219052071,0.690079011482112)(0.82506473730641,0.734591708657533)(0.88853125556075,0.776146464291757)(0.951997773815089,0.814575952050336)(1.01546429206943,0.849725429949514)(1.07893081032377,0.881453363447582)(1.14239732857811,0.909631995354518)(1.20586384683245,0.934147860265107)(1.26933036508679,0.954902241444074)(1.33279688334112,0.971811568323542)(1.39626340159546,0.984807753012208)(1.4597299198498,0.993838464461254)(1.52319643810414,0.998867339183008)(1.58666295635848,0.999874127673875)(1.65012947461282,0.996854775951942)(1.71359599286716,0.989821441880933)(1.7770625111215,0.978802446214779)(1.84052902937584,0.963842158559942)(1.90399554763018,0.945000818714669)(1.96746206588452,0.922354294104581)(2.03092858413886,0.895993774291336)(2.0943951023932,0.866025403784439)(2.15786162064753,0.832569854634771)(2.22132813890187,0.795761840530832)(2.28479465715621,0.755749574354258)(2.34826117541055,0.712694171378863)(2.41172769366489,0.666769000516292)(2.47519421191923,0.618158986220606)(2.53866073017357,0.567059863862771)(2.60212724842791,0.513677391573407)(2.66559376668225,0.458226521727411)(2.72906028493659,0.400930535406614)(2.79252680319093,0.342020143325669)(2.85599332144527,0.28173255684143)(2.91945983969961,0.220310532786541)(2.98292635795395,0.15800139597335)(3.04639287620828,0.0950560433041829)(3.10985939446262,0.0317279334980681)(3.17332591271696,-0.0317279334980679)(3.2367924309713,-0.0950560433041826)(3.30025894922564,-0.15800139597335)(3.36372546747998,-0.220310532786541)(3.42719198573432,-0.281732556841429)(3.49065850398866,-0.342020143325669)(3.554125022243,-0.400930535406613)(3.61759154049734,-0.45822652172741)(3.68105805875168,-0.513677391573406)(3.74452457700602,-0.567059863862771)(3.80799109526036,-0.618158986220605)(3.87145761351469,-0.666769000516292)(3.93492413176903,-0.712694171378863)(3.99839065002337,-0.755749574354258)(4.06185716827771,-0.795761840530832)(4.12532368653205,-0.832569854634771)(4.18879020478639,-0.866025403784438)(4.25225672304073,-0.895993774291336)(4.31572324129507,-0.922354294104581)(4.37918975954941,-0.945000818714668)(4.44265627780375,-0.963842158559942)(4.50612279605809,-0.978802446214779)(4.56958931431243,-0.989821441880933)(4.63305583256677,-0.996854775951942)(4.69652235082111,-0.999874127673875)(4.75998886907544,-0.998867339183008)(4.82345538732978,-0.993838464461254)(4.88692190558412,-0.984807753012208)(4.95038842383846,-0.971811568323542)(5.0138549420928,-0.954902241444074)(5.07732146034714,-0.934147860265107)(5.14078797860148,-0.909631995354519)(5.20425449685582,-0.881453363447582)(5.26772101511016,-0.849725429949514)(5.3311875333645,-0.814575952050336)(5.39465405161884,-0.776146464291757)(5.45812056987318,-0.734591708657534)(5.52158708812751,-0.690079011482113)(5.58505360638185,-0.64278760968654)(5.64852012463619,-0.59290792905464)(5.71198664289053,-0.540640817455597)(5.77545316114487,-0.486196736100469)(5.83891967939921,-0.429794912089172)(5.90238619765355,-0.371662455660328)(5.96585271590789,-0.312033445698487)(6.02931923416223,-0.251147987181079)(6.09278575241657,-0.189251244360411)(6.15625227067091,-0.12659245357375)(6.21971878892525,-0.0634239196565654)(6.28318530717959,-2.44929359829471e-16) 
};
\end{axis}
\end{tikzpicture}%

\end{document}

我收到错误,表明我忘记了某个}地方。

但是,如果我注释掉外部化的两行,它就可以正常工作,因此图形代码没有任何问题。

直到最近我才遇到过这个问题,但我真的不知道是什么引发了这个问题。我安装了 pgfplots 和 tikz 的最新版本(不稳定),但这之前没有引起任何问题。最近的变化是我尝试安装字体MinionPro,但我看不出这有什么关系?

我可以找到遇到编译错误的日志这里

昨晚我也尝试安装新 TL 的预测试,但情况仍然一样。有什么建议吗?

答案1

该问题是由于您使用了不稳定的 TikZ 开发版本而引起的。

在撰写本文时,texample.net 上的 PGF 版本包含外部库中的错误(3 天后已修复)。您的问题几乎肯定是由这些更改引起的。您需要至少 5 月 22 日的构建日期才能修复错误。

相关内容