CTAN Comprehensive TeX Archive Network

boolexpr – A boolean expression evaluator and a switch command

The \boolexpr macro evaluates boolean expressions in a purely expandable way.

\boolexpr{ A \OR B \AND C } expands to 0 if the logical expression is TRUE. A, B, C may be: numeric expressions such as: x=y, x<>y, x>y or x<y;
– boolean switches: \iftrue 0\else 1\fi;
– conditionals: \ifcsname whatsit\endcsname 0\else 1\fi;
– another \boolexpr: \boolexpr{ D \OR E \AND F }:

\boolexpr may be used with \ifcase:

        \ifcase\boolexpr{ A \OR B \AND C }
           What to do if true
           What to do if false

The \switch command (which is also expandable) has the form:

      \case{<boolean expression>} ...
      \case{<boolean expression>} ...
      \otherwise ...

LicensesThe Project Public License
Copyright2009 Florent Chervet
MaintainerFlorent Chervet
Contained inTeX Live as boolexpr
MiKTeX as boolexpr
TopicsMacro support

Download the contents of this package in one zip archive (161.6k).

Community Comments



Here you can see a respective diagram in newer browsers.


Guest Book Sitemap Contact Contact Author