Skip to content

sometimes pgfNumber is --0.5 and computation fails with warning (and wrong results) #2696

@xworld21

Description

@xworld21

I didn't have time to find the root cause, but it appears that some pgfNumber's can be prefixed with --. It pops up in the following example from the PGFPlots gallery:

\begin{tikzpicture}
	\begin{axis}[view/h=-30]
	\addplot3[
		surf,
		%shader=interp,
		shader=flat,
		samples=20,
		domain=-3:3,y domain=-2:2]
		{sin(deg(x+y^2))};
	\end{axis}
\end{tikzpicture}

I get twice the warning

Warning:perl:warn Argument "--0.5" isn't numeric in multiplication (*) at pgfplot.tex; line 189 col 0

and the offending code is in pgfmath.code.tex.ltxml

DefMacro('\pgfmathmultiply@ pgfNumber pgfNumber', sub {
    return pgfmathresult($_[1] * $_[2]); });

So somewhere within pgfplots, the pgfNumber argument is --0.5, which Perl does not interpret as a number.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions