Command/define

From Wiki
< Command
Revision as of 00:20, 24 September 2010 by Phg (talk | contribs) (→‎Description: fine in luatex)
Jump to navigation Jump to search

\define

Syntax

\define[...]\command{...}
[...] number
{...} text


Description

\define is like the TeX primitive \def: it defines a new TeX macro. Unlike \def, it will not allow you to redefine an already defined command.

The optional (bracketed) argument denotes the number of parameters you can give to your command. "text" is the result when the macro gets expanded.

\define does not use \long, that means in MkII multiple paragraphs (e.g. through \par or \endgraf) inside arguments will not work.

comment

is there any bonus when I use \define instead of \def? -PG


Example

\define[1]\hello{Good morning, #1!}

\starttext
\hello{mom}
\stoptext

See also

http://en.wikibooks.org/wiki/TeX/def