A new command (macro) is defined with


and used simply by \name.

With the definition


you get the mathematical symbol $\Gamma_{i}$ simply by \gi.

This definition only works in math mode, so in text mode it has to be enclosed in $ $\ldots$ $. To avoid this, one can use the \ensuremath command. It ensures that its argument is in math mode, doing it explicitly, if necessary:


A new command with parameters is defined by


where NARGS is the number of parameters. They are used in DEFINITION as #1, #2, $\ldots$

After the definition

\newcommand{\veca}[1]{\ensuremath{#1_1, \ldots, #1_n}}

the text

We consider the series \veca{a} and \veca{b}.


Macro definitions can appear anywhere, but are usually collected in the preamble.

Macros are not only used for shortcuts, but are important to describe the logical structure of a document.

Assume a document contains a lot of term definitions, which are usually displayed with bold face. The macro


makes this logical meaning clearer than using simply \textbf. Moreover, if one decides to use italics instead and put all definitions into an index at the end, this can be done by simply changing the macro.

previous    contents     next

Peter Junglas 15.5.2000