TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

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 ?

share|improve this question
up vote 6 down vote accepted

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

share|improve this answer

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.