When I run the following code...


\pgfmathsetmacro\foo{(2<3) && (3<4)}

I get

ERROR: Argument of \pgfmath@@onquick has an extra }.

If I use \pgfmathtruncatemacro, I get the same error. However:

  • If I delete the tabular environment, it works fine.

  • If I replace the operation with and((2<3),(3<4)), it works fine.

  • If I use \pgfmathparse...\pgfmathresult, it works fine.

Is there a fix for this? Clearly the problem is that tabular is somehow reading & as a row separator. (Currently, I use and instead of && in all my pgfmath code, for fear that my macros might be eventually put inside a tabular.)

  • 2
    You can hide it from tabular via extra braces {\pgfmathsetmacro\foo{((2<3) && (3<4))}\foo}
    – percusse
    Jun 20, 2013 at 5:32
  • @percusse Looks like the core of an answer to me
    – Joseph Wright
    Aug 19, 2013 at 10:39

1 Answer 1


\pgfmathsetmacro uses a \begingroup \endgroup group for its calculations which isn't enough to hide && from tabular, you could redefine it to use { instead but no promises that that doesn't break something else in pgf.

This works though:



\pgfmathsetmacro\foo{(2<3) && (3<4)}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .