The macro DEFINEMACRO
lets you define new macros. This macro requires
three parameter lists:
ARG
x, x being 1, 2, etc.. At these places
the arguments to the macro will be pasted in. The numbers that identify
the arguments are 1 to 9, then A to Z and finally a to z. This gives a
range of 61 expandable arguments, that should be enough for most
applications.
For example, the following fragment defines a macro bookref
, which can be
used to typeset a reference to a book. It requires three arguments; say, an
author, a title and the name of a publisher:
DEFINEMACRO(bookref)(3) (Author(s): ARG1 Book title: ARG2 Published by: ARG3)
Such a macro could be used as:
bookref(Sobotta/Becher) (Atlas der Anatomie des Menschen) (Urban und Schwarzenberg, Berlin, 1972)
It would of course lead to:
Author(s): Sobotta/Becher Book title: Atlas der Anatomie des Menschen Published by: Urban und Schwarzenberg, Berlin, 1972
While applying a macro, the three parameter lists are pasted to the places
where ARG1
, ARG2
etc. occur in the definition.
A few caveats when defining new macros are:
(bookref)
in the above example, must occur right after
DEFINEMACRO
. No spaces are allowed in between. Space characters and
newlines may however occur following this first parameter list.
This behavior of the yodl
program is similar to the usage of the
defined macro: the author information must, enclosed in parentheses,
follow right after the bookref
identifier. I implemented this feature
to improve the distinguishing between macros and real text. E.g., a macro
me
might be defined, but the text
I like me (but so do you)
still is simple text; the macro me
only is activated when a
parenthesis immediately follows it.
DEFINEMACRO(bookref)(3)( Author(s): ARG1 Book title: ARG2 Published by: ARG3)
introduces an extra newline, that will be copied to the output each time
that the macro is used. The extra newline occurs, of course, right before
the sequence Author(s):
. A simple backslash character at the end of
the DEFINEMACRO
line would prevent the insertion of an extra newline
character.
it
that starts a
bullet item in a list. The macro takes no arguments, but still must be
typed as it()
.
This behavior is consistent: it helps distinguish which identifiers are macros and which are simple text.
Please send Yodl questions and comments to yodl@icce.rug.nl.
Please send comments on these web pages to (address unknown)
Copyright (c) 1997, 1998, 1999 Karel Kubat and Jan Nieuwenhuizen.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.