The next step is to define macros that can change from one
according to parameters supplied as arguments.
To make this work, we need two things:
first, when we define the macro, we have to indicate that some
parts of it will be provided as arguments when the macro is called.
we have to provide actual arguments
to be plugged into the definition.
Let us illustrate by defining a macro
that will print its argument two points
smaller than the surrounding text.
Within a macro definition,
that the macro was called with.
is the string to be placed in a smaller point
As a slightly more complicated version, the following definition of
permits optional second and third arguments
that will be printed in the normal size:
\e\e$3\es\-2\e\e$1\es+2\e\e$2
Arguments not provided when the macro is called are treated
It is convenient to reverse
the order of arguments because trailing punctuation
is much more common than leading.
By the way, the number of arguments that a macro was called with
is available in number register
is the one used to make the
`bold roman' we have been using for
It combines horizontal motions, width computations,
and argument rearrangement.
\e&\e\e$3\ef1\e\e$1\eh'\-\ew'\e\e$1'u+1u'\e\e$1\efP\e\e$2
commands need no extra backslash, as we discussed above.
is there in case the argument begins with a period.
Two backslashes are needed with the
to protect one of them when the macro is
Perhaps a second example will make this clearer.
produces section headings rather like those in this paper,
with the sections numbered automatically,
and the title in bold in a smaller size.
(If the argument to a macro is to contain blanks,
unlike a string, where only one leading quote is permitted.)
Here is the definition of the
^nr SH 0 \e" initialize section number
^nr SH \e\en(SH+1 \e" increment number
^ps \e\en(PS\-1 \e" decrease PS
\e\en(SH. \e\e$1 \e" number. title
^ps \e\en(PS \e" restore PS
The section number is kept in number register SH, which is incremented each
time just before it is used.
(A number register may have the same name as a macro
without conflict but a string may not.)
we would get the value of the register at the time the macro was
If that's what you want, fine,
we get the point size at the time the macro is called.
As an example that does not involve numbers,
We could make these into parameters by using instead
^tl '\e\e*(LT'\e\e*(CT'\e\e*(RT'
so the title comes from three strings called LT, CT and RT.
If these are empty, then the title will be a blank line.
Normally CT would be set with something like
to give just the page number between hyphens (as on the top of this page),
but a user could supply private definitions for