This simple example will fail because of the priority rules are not taken into account :


\ifthenelse{ {\toto=3\and\bibi=2} \or {\bibi=5\and\toto=1} }{Yes}{No}

It should produce "Yes" but it produces "No" because the last "\and" test is not met.

So what is the best way to deal with this kind of tests, and the more complicated one witch causes me trouble, that is :

[(a and b) or (c and d)] and (e or f)

where a,...,f are booleans ?


You can use \( and \) within \ifthenelse conditionals to explicitly nest expressions. Do not use {} brace groups as shown in your example.

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.