Menu
CTAN
Comprehensive TeX Archive Network
Cover Upload Browse Search

Direc­tory tex-archive/macros/latex/contrib/boolexpr

% boolexpr : Purely expandable boolean expressions and switch (eTeX - v3.1 2009/09/30)
%
% The \boolexpr macro evaluate 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
%     \else
%           What to do if false
%     \fi
%
% \switch remains *purely expandable* (it may be used inside \csname...\endcsname f.ex.)
%
% \switch
% \case{ boolean expression} to do in first case
% \case{ boolean expression} to do in second case
% \otherwise to do if no case were true
% \endswitch
%
% \switch may have an optional argument to repeat in each \case evaluation, e.g. :
%
% \switch[\value{myCounter}]
%      %|--|        --------------------------------------------------->   |--|
% \case{>=12}It's $>=12$% => \case will expand to : \case{\value{myCounter}>=12}
% \case{=1}It's $1$%      => \case will expand to : \case{\value{myCounter}=1}
% \otherwise ...
% \endswitch
%
% or : *(NB the double curly braces)*
% \switch[\pdfstrcmp{dummy}}]
%      %|-----|   ------------------------------------------------>  |-----|
% \case{{first}}It's "FiRsT"% => \case{\lowercase{\ifstrequal{dummy}}{first}}
% \case{{second}}It"s "SeCoNd"%=> \case{\lowercase{\ifstrequal{dummy}}{second}
% \endswitch
%
% *********************************************************************************
% This work consists of the main source file boolexpr.dtx and the derived
% files :  boolexpr.sty, boolexpr.pdf, boolexpr.ins
%
% Some examples are included in the documentation: it is preferable (albeit
% not necessary) to install boolexpr.sty before compiling the documentation.
%
% Unpacking:
%    (a) If boolexpr.ins is present:
%           etex boolexpr.ins
%    (b) Without boolexpr.ins:
%           etex boolexpr.dtx
%    (c) If you insist on using LaTeX
%           latex \let\install=y\input{boolexpr.dtx}
%        (quote the arguments according to the demands of your shell)
%
% Documentation:
%           (pdf)latex boolexpr.dtx
%           makeindex -s gind.ist boolexpr.idx
%
% F Chervet - Jul-Sep 2009

Files

Name Size Date Notes
README 2471 2009-09-30 14:59
boolexpr.dtx 43040 2010-04-12 12:15
boolexpr.ins 2504 2010-04-12 12:16
boolexpr.pdf 221162 2010-04-12 12:16
boolexpr.sty 6949 2010-04-12 12:16

Down­load the con­tents of this pack­age in one zip archive (161.6k).

bool­expr – A boolean ex­pres­sion eval­u­a­tor and a switch com­mand

The \bool­expr macro eval­u­ates boolean ex­pres­sions in a purely ex­pand­able way.

\bool­expr{ A \OR B \AND C } ex­pands to 0 if the log­i­cal ex­pres­sion is TRUE. A, B, C may be: nu­meric ex­pres­sions such as: x=y, x<>y, x>y or x<y; – boolean switches: \iftrue 0\else 1\fi;
– con­di­tion­als: \ifc­sname what­sit\end­c­sname 0\else 1\fi;
– an­other \bool­expr: \bool­expr{ D \OR E \AND F }:

\bool­expr may be used with \if­case:
  \if­case\bool­expr{ A \OR B \AND C }
    What to do if true
  \else
    What to do if false
  \fi

The \switch com­mand (which is also ex­pand­able) has the form:
\switch
\case{<boolean ex­pres­sion>} ...
\case{<boolean ex­pres­sion>} ...
... \oth­er­wise ...
\endswitch

Pack­age De­tailsbool­expr
Ver­sion3.14
Li­censeThe LaTeX Project Public Li­cense
Copy­right2009 Florent Chervet
Main­tainerFlorent Chervet
Con­tained inTeXlive as bool­expr
MikTeX as bool­expr
Topics sup­port for de­vel­op­ment of (La)TeX macros
Guest Book Sitemap Contact