A TeX parameter token marks an argument position in a TeX macro definition. With ordinary category assignments,
#1 through #9 name the available positions. During TeX expansion, the supplied argument tokens replace the corresponding placeholders.[ref]For an original example,
\def\twice#1{#1:#1} followed by \twice{ab} expands to ab:ab. The braces delimit one argument containing two character tokens; they are not copied into the replacement at each placeholder. Calling \twice7 instead gives 7:7. Thus #1 identifies an argument slot rather than instructing TeX to print the digit 1.The definition's replacement list can be inspected before execution. Its placeholders remain distinct from ordinary digit tokens, even when an actual argument happens to be a digit. This separation makes token substitution useful for reusable notation.
Articles by others on the same topic
There are currently no matching articles.