IFZERO
macro expects three parameter lists, just as the other
IF...
macros: a symbol, a true-list and a false-list.
The first argument defines whether the whole macro expands to the true-list or
to the false-list. The first argument may be:
COUNTERVALUE(somecounter)
as the argument to IFZERO
, it is
treated in the same manner as the corresponding counter name.
Example: The IFZERO
macro offers a very simple way to pass a flag-argument
(an on/off switch) to a macro. E.g., in LaTeX you start environments with
\begin{environment}
and end them with \end{environment}
;
environment
being e.g., center
, flushright
, flushleft
. A
possible meta-macro for the environments might be:
DEFINEMACRO(environment)(2)(\ IFZERO(ARG2)\ NOEXPAND(\end{ARG1})\ NOEXPAND(\begin{ARG1}))
Such a macro may be used as:
environment(center)(1) Now comes centered text. environment(center)(0)
which would of course lead to \begin
and \end{center}
. The numeric
second argument is used here as a on/off switch.
Please send Yodl questions and comments to yodl@icce.rug.nl.
Please send comments on these web pages to
(address unknown),
send other FSF & GNU inquiries and questions to
Copyright (c) 1998 Karel Kubat and Jan Nieuwenhuizen
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.