A TeX macro associates a TeX control sequence with a replacement list of TeX tokens, possibly containing parameters. During TeX expansion, arguments are substituted into that list. Character tokens retain their TeX category codes, so this mechanism has more structure than unrestricted replacement of raw text strings.[ref]
TeX by Topic by Victor Eijkhout. §§11.2,11.5 and12.1: definitions, parameters and token-stream expansion
For a simple example,
\def\dup#1{#1+#1} defines a macro with one parameter. In mathematics, $\dup{x}$ yields the token sequence for . With $\dup{u+v}$, the expansion gives . The replacement duplicates the supplied tokens; it does not evaluate or simplify the mathematical expression.This makes TeX macros useful for reusable notation. A document can express an intention through one command and change the associated presentation centrally. The actual printed result still depends on subsequent execution, computer fonts and mathematical typesetting.
Articles by others on the same topic
There are currently no matching articles.