This must be my week for stepping on reserved words... please look at this MWE:


    \pgfmathprintnumberto[assume math mode=true, fixed, precision=3]{\rpval}{\frpval}%
\tikzset{declare function={%
        R0 = 2.0;
        X = 0.5*R0;
        ON = 3;
        OFF(\x) = \x + 1;
        AFF(\x) = \x + 1;

%  works
X is \formula{X}

% fails
ON is \formula{ON}

% works
AFF is \formula{AFF(1)}

% fails
OFF is \formula{OFF(1)}

The second and fourth line fail with

! Package PGF Math Error: Unknown operator `O' or `ON' (in 'ON').

! Package PGF Math Error: Unknown operator `O' or `OF' (in 'OFF(1)').

...and it seems it is doing the same for every constant starting with O are creating problems.

I think I am doing something very silly...

  • It doesn't have to start with O. All of ONN, NON and NNO fail... – Phelype Oleinik Dec 2 at 19:47
  • ...lowercase o works... – Rmano Dec 2 at 19:54

Update: This has been fixed and your document should work fine after the next TikZ/PGF release.

In pgfmathparser.code.tex you see:


without an O.

O doesn't seem to be a reserved keyword (after all, you get an “Unknown operator” error), thus I believe this is a bug.

Providing the missing definition:


seems to solve the problem.

I just find it curious that you are the first person to try to use an O there :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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