# \defenv¶

Command in package userctrl.

## Synopsis¶

\defenv{name}[num-args][num-opt-args{default-1}{default-1}...]
[before-begin-code][after-end-code]
{begin-code}{end-code}


## Description¶

Defines a new environment. The arguments have the following meanings:

name

The name of the environment.

num-args

The total number of arguments (mandatory and optional).

num-opt-args

The number of optional arguments.

default-1default-2 ...

Defaults for the optional arguments.

before-begin-code

Code to execute before Mmtex starts the context of the environment.        For experts only, normal users will hardly need this.

after-end-code

Code to execute after Mmtex has closed the context of the environment.        For experts only, normal users will hardly need this.

begin-code

Code to execute when the environment starts.

end-code

Code to execute when the environment ends.

## Example¶

\newcounter{mylist}
\setcounter{mylist}{0}

\defenv{mylist}{
\begin{itemize}
\defcmd{\myitem}[1]{
\stepcounter{mylist}
\item[\strong{\arabic{mylist} (##1)}]}
}{\end{itemize}}

\begin{mylist}
\myitem{First} Lorem ipsum dolor sit amet.
\myitem{Second} Nulla consequat massa quis enim.
\end{mylist}

Result, as rendered by your browser

 1 (First) Lorem ipsum dolor sit amet. 2 (Second) Nulla consequat massa quis enim.

This page is generated automatically and each change here will be replaced on a next update.

Add picture from clipboard (Maximum size: 500 MB)