Next: , Previous: \newsavebox, Up: Definitions


12.5 \newenvironment & \renewenvironment

Synopses:

       \newenvironment{env}[nargs]{begdef}{enddef}
       \newenvironment{env}[nargs][default]{begdef}{enddef}
     \renewenvironment{env}[nargs]{begdef}{enddef}

These commands define or redefine an environment env, that is, \begin{env} ... \end{env}.

env
The name of the environment. For \newenvironment, env must not be an existing environment, and the command \env must be undefined. For \renewenvironment, env must be the name of an existing environment.
nargs
An integer from 1 to 9 denoting the number of arguments of the newly-defined environment. The default is no arguments.
default
If this is specified, the first argument is optional, and default gives the default value for that argument.
begdef
The text expanded at every occurrence of \begin{env}; a construct of the form #n in begdef is replaced by the text of the nth argument.
enddef
The text expanded at every occurrence of \end{env}. It may not contain any argument parameters.