pgfplots:“let \p1”命令在轴环境中不再起作用,以前编译得很好

pgfplots:“let \p1”命令在轴环境中不再起作用,以前编译得很好

我最近在使用 MiKTeX 发行版时遇到了一些问题,于是我重新安装了 MiKTeX 和 TeXstudio,并清除了机器上的所有首选项、用户设置等。我能够解决问题,但出于某种奇怪的原因,过去 4 年(!)编译正常的 tikzpicture 不再工作了。我已将问题缩小到以下 MWE 中使用“let \p1”命令语法(第 15 行)的行:

\documentclass[crop,tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usetikzlibrary{calc}

\begin{document}
    \begin{tikzpicture}[>=latex]
        \begin{axis}[tick style={color=black}, width=5cm, height=5cm,
        xmin=0, xmax=2e-4,
        ymin=0, ymax=2e-4,
        ticks=none]
            \coordinate (O) at (axis cs:0,0);
            \coordinate (Rm) at (axis cs:1.5e-05,0);
            %
            \draw[very thin, fill=cyan] let \p1=($(Rm)-(O)$) in (axis cs:8.2902e-05,0.00017327) coordinate (M) circle ({veclen(\x1,\y1)});
            \draw[->, red] (M) -- ++(axis cs:1.0607e-05,1.0607e-05) node[pos=0,below,inner sep=0,color=white] {\footnotesize{$r_m$}};
        \end{axis}
    \end{tikzpicture}
\end{document}

现在最奇怪的是:我把 MWE 交给了一位同事,他的安装已经有几年了,他告诉我他上次更新它大概是在一年多以前。而且在他那里编译得很好!不过,我无法弄清楚我们的两台机器之间有什么区别,而且更改兼容性\pgfplotsset似乎不会影响编译。

这是我的错误输出:

line 17: Argument of \pgfmathfloatparse@@ has an extra }. \end{axis}
line 17: Paragraph ended before \pgfmathfloatparse@@ was complete. \end{axis}
line 17: Extra }, or forgotten \endgroup. \end{axis}
line 17: Extra \else. \end{axis}
line 17: Undefined control sequence. \end{axis}
line 17: Package PGF Math Error: Sorry, an internal routine of the floating point unit part was near '-5.15831000000000'.. \end{axis}
line 17: Package PGF Math Error: Sorry, an internal routine of the floating point unit part was near '-5.15831000000000'.. \end{axis}
line 17: Package PGF Math Error: Sorry, an internal routine of the floating point unit part was near '-5.15831000000000'.. \end{axis}
line 17: Package PGF Math Error: Sorry, an internal routine of the floating point unit part was near '-5.15831000000000'.. \end{axis}
line 17: Package PGF Math Error: Sorry, an internal routine of the floating point unit part was near '-5.15831000000000'.. \end{axis}
line 17: Missing number, treated as zero. \end{axis}
line 17: Illegal unit of measure (pt inserted). \end{axis}
line 17: Package PGF Math Error: Sorry, an internal routine of the floating point unit part was near '-5.15831000000000'.. \end{axis}
line 17: Illegal unit of measure (pt inserted). \end{axis}
line 17: Illegal unit of measure (pt inserted). \end{axis}
line 17: Package PGF Math Error: Sorry, an internal routine of the floating point unitpart was near '5.15831000000000'.. \end{axis}
line 17: Package PGF Math Error: Sorry, an internal routine of the floating point unitpart was near '5.15831000000000'.. \end{axis}
line 17: Package PGF Math Error: Sorry, an internal routine of the floating point unitpart was near '5.15831000000000'.. \end{axis}
line 17: Package PGF Math Error: Sorry, an internal routine of the floating point unitpart was near '5.15831000000000'.. \end{axis}
line 17: Package PGF Math Error: Sorry, an internal routine of the floating point unitpart was near '5.15831000000000'.. \end{axis}
line 17: Missing number, treated as zero. \end{axis}
line 17: Illegal unit of measure (pt inserted). \end{axis}
line 17: Package PGF Math Error: Sorry, an internal routine of the floating point unitpart was near '5.15831000000000'.. \end{axis}
line 17: Illegal unit of measure (pt inserted). \end{axis}
line 17: Illegal unit of measure (pt inserted). \end{axis}
line 17: Missing } inserted. \end{axis}
line 17: Extra }, or forgotten \endgroup. \end{axis}
line 17: Missing } inserted. \end{axis}
line 17: Extra }, or forgotten \endgroup. \end{axis}
line 17: Missing } inserted. \end{axis}
line 17: Extra }, or forgotten \endgroup. \end{axis}
line 17: Extra }, or forgotten \endgroup. \end{axis}
line 18: Missing } inserted. \end{tikzpicture}
line 18: Missing } inserted. \end{tikzpicture}
line 18: Extra }, or forgotten \endgroup. \end{tikzpicture}
line 18: Missing } inserted. \end{tikzpicture}
line 18: Extra }, or forgotten \endgroup. \end{tikzpicture}
line 18: Missing } inserted. \end{tikzpicture}
line 18: Extra }, or forgotten \endgroup. \end{tikzpicture}
line 18: Improper \prevdepth. \end{tikzpicture}
line 18: Missing \endgroup inserted. \end{tikzpicture}
line 18: Missing \endgroup inserted. \end{tikzpicture}
line 18: Missing } inserted. \end{tikzpicture}

我的构建命令是:

pdflatex.exe -shell-escape -synctex=1 -interaction=nonstopmode %.tex

答案1

您正在使用已弃用的圆语法,circle(<radius>)但您应该使用circle[radius=<radius>]。那么就没有问题了。

\documentclass[crop,tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usetikzlibrary{calc}

\begin{document}
    \begin{tikzpicture}[>=latex]
        \begin{axis}[tick style={color=black}, width=5cm, height=5cm,
        xmin=0, xmax=2e-4,
        ymin=0, ymax=2e-4,
        ticks=none]
            \coordinate (O) at (axis cs:0,0);
            \coordinate (Rm) at (axis cs:1.5e-05,0);
            %
            \draw[very thin, fill=cyan] let \p1=($(Rm)-(O)$) in (axis
            cs:8.2902e-05,0.00017327) coordinate (M) circle[radius={veclen(\x1,\y1)}];
            \draw[->, red] (M) -- ++(axis cs:1.0607e-05,1.0607e-05) node[pos=0,below,inner sep=0,color=white] {\footnotesize{$r_m$}};
        \end{axis}
    \end{tikzpicture}
\end{document}

在此处输入图片描述

注意此问题已报告但使用非弃用的语法也可以解决这个问题。

相关内容