我有一个旧文档,正在尝试重新编译,但 3D 绘图不再起作用。我将其简化为以下 MWE:
\usemodule[tikz]
\usemodule[pgfplots]
\pgfplotsset{compat=1.18}
\starttext
\starttikzpicture[scale=1]
\startaxis[
xmin=0, xmax=10, ymin=2, ymax=8, ticks=none,
]
\addplot3 [surf, shader=interp, domain=0:10] { (x-5)^2 };
\stopaxis
\stoptikzpicture
\stoptext
我收到指向该\stopaxis
命令的以下错误:
A prefix should be followed by a quantity that can be assigned to. Intermediatespaces and \relax tokens are gobbled in the process.
这似乎与 tikz 的内部有关,所以我真的不知道该怎么做...有解决方法吗?
提前致谢,
答案1
下面的补丁可以解决这个问题:
diff --git a/texmf-modules/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex b/texmf-modules/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex
index 60d6274..106c490 100644
--- a/texmf-modules/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex
+++ b/texmf-modules/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex
@@ -2804,6 +2804,9 @@
\def\pgfplotsretval{4}%
\fi
\fi
+ \if0\pgfplotsretval
+ \def\pgfplotsretval{5}
+ \fi
\pgfkeyslet{/pgfplots/surf shading/shading type}\pgfplotsretval%
%
\pgfplotsplothandlermesh@set@shader@colormap
diff --git a/texmf-modules/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-luatex.def b/texmf-modules/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-luatex.def
index 0046daa..b563732 100644
--- a/texmf-modules/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-luatex.def
+++ b/texmf-modules/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-luatex.def
@@ -61,7 +61,7 @@
\pgfplotslibrarysurfusepath
\endpgfpicture
}%
- \immediate\saveboxresource resources{
+ \saveboxresource resources{
/Pattern << \pgfplots@glob@TMPa >> % write the pattern resource dictionary
}\pgfutil@tempboxa
\leavevmode
然后,下面的文档编译成功:
\usemodule[tikz]
\usemodule[pgfplots]
\pgfplotsset{compat=1.18}
\startTEXpage[offset=1dk]
\starttikzpicture
\startaxis
\addplot3 [surf, shader=interp, domain=0:10] { (x-5)^2 };
\stopaxis
\stoptikzpicture
\stopTEXpage