TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the code snippet below I would have expected both r(x) and s(x) to be the same line, but the output is two radically different lines as shown below.

enter image description here

If there is a problem using the name r as a function name, then I would have expected some sort of error message, but did not find one.



\tikzstyle{MyPlotStyle}=[domain=-5:5, samples=50, ultra thick]

Plot of $r(x)=2$ and $s(x)=2$ using PGF Version \pgfversion.

    \addplot[MyPlotStyle, red ]{r(x)};
    \addplot[MyPlotStyle, blue]{s(x)};
share|improve this question
up vote 11 down vote accepted

In pgfmathparser.code.tex, r is defined as a math operator that applies the deg function, to be able to specify angles in radians (\pgfmathparse{3.14r}\pgfmathresult yields (almost) 180), so you shouldn't use this name for your own functions. I agree, though, that there should be an error message if you try to define a new function with a name that's already taken by an operator, especially since operators seem to take precedence. You might want to file a bug report / feature request for this.

share|improve this answer
I suspected it was something like that but since I saw no error message, I wasn't sure. Where do I file this bug report? – Peter Grill May 31 '11 at 9:57
@Peter: The PGF project uses Sourceforge: sourceforge.net/tracker/?group_id=142562 – Jake May 31 '11 at 10:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.