# How to deal with conditions with many nested \and and \or?

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

\documentclass{article}
\usepackage{ifthen}

\begin{document}
\newcommand{\bibi}2
\newcommand{\toto}3
\ifthenelse{ {\toto=3\and\bibi=2} \or {\bibi=5\and\toto=1} }{Yes}{No}
\end{document}


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.