| 1 |
% boolexpr : Purely expandable boolean expressions and switch (eTeX - v3.1 2009/09/30) |
| 2 |
% |
| 3 |
% The \boolexpr macro evaluate boolean expressions in a *purely expandable way*. |
| 4 |
% |
| 5 |
% \boolexpr{ A \OR B \AND C } expands to 0 if the logical expression is TRUE. |
| 6 |
% |
| 7 |
% A, B, C may be : |
| 8 |
% - numeric expressions such as: x = y, x <> y, x > y or: x < y |
| 9 |
% - boolean switches: \iftrue 0\else 1\fi |
| 10 |
% - conditionals: \ifcsname whatsit\endcsname 0\else 1\fi |
| 11 |
% - another \boolexpr: \boolexpr{ D \OR E \AND F } |
| 12 |
% |
| 13 |
% \boolexpr may be used with \ifcase: |
| 14 |
% \ifcase\boolexpr{ A \OR B \AND C } |
| 15 |
% What to do if true |
| 16 |
% \else |
| 17 |
% What to do if false |
| 18 |
% \fi |
| 19 |
% |
| 20 |
% \switch remains *purely expandable* (it may be used inside \csname...\endcsname f.ex.) |
| 21 |
% |
| 22 |
% \switch |
| 23 |
% \case{ boolean expression} to do in first case |
| 24 |
% \case{ boolean expression} to do in second case |
| 25 |
% \otherwise to do if no case were true |
| 26 |
% \endswitch |
| 27 |
% |
| 28 |
% \switch may have an optional argument to repeat in each \case evaluation, e.g. : |
| 29 |
% |
| 30 |
% \switch[\value{myCounter}] |
| 31 |
% %|--| ---------------------------------------------------> |--| |
| 32 |
% \case{>=12}It's $>=12$% => \case will expand to : \case{\value{myCounter}>=12} |
| 33 |
% \case{=1}It's $1$% => \case will expand to : \case{\value{myCounter}=1} |
| 34 |
% \otherwise ... |
| 35 |
% \endswitch |
| 36 |
% |
| 37 |
% or : *(NB the double curly braces)* |
| 38 |
% \switch[\pdfstrcmp{dummy}}] |
| 39 |
% %|-----| ------------------------------------------------> |-----| |
| 40 |
% \case{{first}}It's "FiRsT"% => \case{\lowercase{\ifstrequal{dummy}}{first}} |
| 41 |
% \case{{second}}It"s "SeCoNd"%=> \case{\lowercase{\ifstrequal{dummy}}{second} |
| 42 |
% \endswitch |
| 43 |
% |
| 44 |
% ********************************************************************************* |
| 45 |
% This work consists of the main source file boolexpr.dtx and the derived |
| 46 |
% files : boolexpr.sty, boolexpr.pdf, boolexpr.ins |
| 47 |
% |
| 48 |
% Some examples are included in the documentation: it is preferable (albeit |
| 49 |
% not necessary) to install boolexpr.sty before compiling the documentation. |
| 50 |
% |
| 51 |
% Unpacking: |
| 52 |
% (a) If boolexpr.ins is present: |
| 53 |
% etex boolexpr.ins |
| 54 |
% (b) Without boolexpr.ins: |
| 55 |
% etex boolexpr.dtx |
| 56 |
% (c) If you insist on using LaTeX |
| 57 |
% latex \let\install=y\input{boolexpr.dtx} |
| 58 |
% (quote the arguments according to the demands of your shell) |
| 59 |
% |
| 60 |
% Documentation: |
| 61 |
% (pdf)latex boolexpr.dtx |
| 62 |
% makeindex -s gind.ist boolexpr.idx |
| 63 |
% |
| 64 |
% F Chervet - Jul-Sep 2009 |