Macro expansion

Back to Macros

Macro expansion refers to the process of taking a macro invocation and replacing it with the output of the macro. In Remark, this process can be carried out in different ways depending on the need.

Controlling expansion

In a macro invocation the user has explicit control over

These behaviors can be set by using a pair of signs (+ or -) before the name of the macro. In this notation + means yes and - means no. The first sign refers to the expansion of the output, while the second sign refers to the expansion of the parameter. For example, the following invocation of the Verbatim macro explicitly disables the expansion of the output and enables the expansion of the parameter.

[[-+Verbatim]]: [[tag description]]
Macro expansion

If only one sign is given, then that sign is assumed for both expansions, i.e. - = – and + = ++.

Default behaviors

If the expansion signs are not given, then the expansions assume default behaviors. The default behavior for parameter expansion is not to do it. The default behavior for output expansion is determined by the invoked macro.

Placement of macros

The macros can be placed freely as shown in the following example:

[[set b: Nom]]Nom[[b]] [[b]]Nom[[b]] Nom[[b]]

NomNom NomNomNom NomNom