summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/enumitem
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-03-18 23:45:07 +0000
committerKarl Berry <karl@freefriends.org>2007-03-18 23:45:07 +0000
commit21021668fee1d53809ff3c690d0adf04e3353145 (patch)
treea0649984a2d9b0728b0cd5aae5991992f79121bf /Master/texmf-dist/tex/latex/enumitem
parentcc6f0e9093f42daa94cdf4d28f883cf4f10bdf42 (diff)
enumitem 2.0 (12mar07)
git-svn-id: svn://tug.org/texlive/trunk@4055 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/enumitem')
-rw-r--r--Master/texmf-dist/tex/latex/enumitem/enumitem.sty556
1 files changed, 419 insertions, 137 deletions
diff --git a/Master/texmf-dist/tex/latex/enumitem/enumitem.sty b/Master/texmf-dist/tex/latex/enumitem/enumitem.sty
index 9feec2d3528..a16929a0be8 100644
--- a/Master/texmf-dist/tex/latex/enumitem/enumitem.sty
+++ b/Master/texmf-dist/tex/latex/enumitem/enumitem.sty
@@ -2,29 +2,43 @@
% | Typeset enumitem.tex to get the documentation. |
% +--------------------------------------------------+
%
-% Copyright (c) 2003-2005 by Javier Bezos.
+% Copyright (c) 2003-2007 by Javier Bezos.
% All Rights Reserved.
%
-% This file is part of the enumitem distribution release 1.1
+% This file is part of the enumitem distribution release 2.0
% -----------------------------------------------------------
-%
-% This program can be redistributed and/or modified under the terms
-% of the LaTeX Project Public License Distributed from CTAN
-% archives in directory macros/latex/base/lppl.txt; either
-% version 1 of the License, or any later version.
+%
+% It may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% The Current Maintainer of this work is Javier Bezos.
%
% Notes
% ~~~~~
%
% The tag enit@ is used through the style
+
+% Tasks:
+% -runin
+% -ref*, for adding stuff in the same fashion as label*
%
% Release
% ~~~~~~~
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{enumitem}[2005/05/12 v1.1 Customized lists]
+\ProvidesPackage{enumitem}[2007/03/12 v2.0 Customized lists]
+
+% The package uses a token register very often. To be on the
+% safe side, instead of \toks@, etc., a new one is declared:
-% Reponer \lableindent a 0 siempre
+\newtoks\enit@toks
\@ifundefined{define@key}{\RequirePackage{keyval}}{}%
@@ -91,16 +105,14 @@
\def\enit@calclabel{%
\begingroup
- \enit@calcdef\@arabic\enit@arabic{0}%
- \enit@calcdef\@alph\enit@alph{m}%
- \enit@calcdef\@Alph\enit@Alph{M}%
- \enit@calcdef\@roman\enit@roman{viii}%
- \enit@calcdef\@Roman\enit@Roman{VIII}%
+ \enit@calcdefs
\settowidth\labelwidth{\@itemlabel}%
\xdef\enit@a{\labelwidth\the\labelwidth\relax}%
\endgroup
\enit@a}
+\let\enit@calcdefs\@empty
+
% Used below to gobble \c@ from the internal representation
% of counters.
@@ -116,15 +128,20 @@
% Resume and start
\define@key{enumitem}{resume}[]{%
- \enit@resume\relax}
+ \@nameuse{enit@resume@\@currenvir}\relax}
\define@key{enumitem}{start}[\@ne]{%
\csname c@\@listctr\endcsname#1\relax
\advance\csname c@\@listctr\endcsname\m@ne}
+
+\define@key{enumitem}{resume*}[]{%
+ \PackageError{enumitem}%
+ {Invalid resume* ignored}%
+ {resume* has to be the only key in the optional argument}%
+ \@nameuse{enit@resume@\@currenvir}\relax}
% How the label is aligned
-\let\enit@alignright\@empty
\def\enit@alignleft{%
\def\makelabel##1{\rlap{\enit@format##1}\hss}}
@@ -145,8 +162,7 @@
% Font
\define@key{enumitem}{font}[]{%
- \def\enit@format{#1}% For enumerate/itemize *******
- \def\makelabel##1{\hskip\labelsep\normalfont#1##1}}
+ \def\enit@format{#1}}
% description specific keys
@@ -159,64 +175,198 @@
% Labels and refs
\define@key{enumitem}{label}{%
+ \@nameuse{enit@set\enit@type label}{#1}}
+
+\define@key{enumitem}{label*}{%
+ \ifnum\enit@depth=\@ne
+ \@nameuse{enit@set\enit@type label}{#1}%
+ \else % no level 0
+ \advance\enit@depth\m@ne
+ \enit@toks{#1}%
+ \edef\enit@a{%
+ \noexpand\@nameuse{enit@set\enit@type label}{%
+ \expandafter\noexpand\csname label\enit@prevlabel\endcsname
+ \the\enit@toks}}%
+ \enit@a
+ \advance\enit@depth\@ne
+ \fi}
+
+\def\enit@setenumlabel#1{%
\enit@normlabel{#1}% Returns \enit@a
\expandafter\let\@itemlabel\enit@a
%ie, redefine \labelenumX or \labelitemX.
- \ifx\enit@ref\relax\enit@reflabel{#1}\fi}
+ \ifx\enit@ref\relax\expandafter\enit@reflabel\enit@a\z@\fi}
%ie, only if there is not a previous ref=
-% Normalization is done twice. Not good.
+
+\def\enit@setitemlabel#1{%
+ \expandafter\def\@itemlabel{#1}%
+ \def\enit@a{#1}%
+ \ifx\enit@ref\relax\enit@reflabel{#1}\z@\fi}
+
+\let\enit@setdesclabel\enit@setitemlabel
\define@key{enumitem}{ref}{%
- \enit@reflabel{#1}}
+ \enit@reflabel{#1}\@ne}
%\expandafter\def\csname c@*\endcsname{\csname c@\@enumctr\endcsname}
+\newcommand\AddEnumerateCounter[3]{%
+ \g@addto@macro\enit@labellist{\enit@refstar#1\enit@refstar#2}%
+ \enit@toks\expandafter{\enit@calcdefs}%
+ \edef\enit@calcdefs{%
+ \the\enit@toks
+ \noexpand\enit@calcdef
+ \noexpand#2%
+ \expandafter\noexpand\csname enit@\string#1\endcsname
+ {#3}}}
+
+\let\enit@labellist\@empty
+
+\AddEnumerateCounter{\arabic}{\@arabic}{0}
+\AddEnumerateCounter{\alph}{\@alph}{m}
+\AddEnumerateCounter{\Alph}{\@Alph}{M}
+\AddEnumerateCounter{\roman}{\@roman}{viii}
+\AddEnumerateCounter{\Roman}{\@Roman}{VIII}
+
+% Short Labels
+
+\let\enit@marklist\@empty
+
+% shorthand, expansion
+
+\newcommand\SetEnumerateShortLabel[2]{%
+ \let\enit@a\@empty
+ \def\enit@elt##1##2{%
+ \def\enit@b{#1}\def\enit@c{##1}%
+ \ifx\enit@b\enit@c\else
+ \expandafter\def\expandafter\enit@a\expandafter{%
+ \enit@a
+ \enit@elt{##1}{##2}}%
+ \fi}%
+ \enit@marklist
+ \expandafter\def\expandafter\enit@a\expandafter{%
+ \enit@a
+ \enit@elt{#1}{#2}}%
+ \let\enit@marklist\enit@a}
+
+\SetEnumerateShortLabel{a}{\alph*}
+\SetEnumerateShortLabel{A}{\Alph*}
+\SetEnumerateShortLabel{i}{\roman*}
+\SetEnumerateShortLabel{I}{\Roman*}
+\SetEnumerateShortLabel{1}{\arabic*}
+
+\def\enit@replace#1#2#3{%
+ \enit@toks{}%
+ \def\enit@b##1#2##2\@@nil{%
+ \ifx\@nil##2%
+ \addto@hook\enit@toks{##1}%
+ \else
+ \edef\enit@a{\the\enit@toks}%
+ \ifx\enit@a\@empty\else
+ \PackageError{enumitem}{Extra short label ignored}%
+ {There are more than one short label}%
+ \fi
+ \addto@hook\enit@toks{##1#3}%
+ \enit@b##2\@@nil
+ \fi}%
+ \expandafter\enit@b#1#2\@nil\@@nil
+ \edef#1{\the\enit@toks}}
+
+% ¿Se podría dar una variante para ref?
+
+\def\enit@first@x#1,\@nil{#1}
+
+% This is called \enit@first one,two,three,\@nil\@@nil. If there
+% are just one element #2 is \@nil, otherwise we have to remove
+% the trailing ,\@nil with enit@first@x
+% Returns toks@
+
+\def\enit@first#1,#2\@@nil{%
+ \in@{=}{#1}%
+ \ifin@\else
+ \def\enit@c{#1}%
+ \@ifundefined{KV@enumitem@\expandafter\strip@prefix\meaning\enit@c}{%
+ \def\enit@elt{\enit@replace\enit@c}%
+ \enit@marklist % Returns \enit@toks
+ \ifx\@nil#2%
+ \ifx,#1,\else
+ \edef\enit@c{label=\the\enit@toks}%
+ \fi
+ \else
+ \@temptokena\expandafter{\enit@first@x#2}%
+ \edef\enit@c{label=\the\enit@toks,\the\@temptokena}%
+ \fi}{}%
+ \fi
+ \enit@toks\expandafter{\enit@c}}
+
+\let\enit@shl@enum\enit@toks
+\let\enit@shl@item\enit@toks
+\let\enit@shl@desc\enit@toks
+
+% Labels
+
\def\enit@normlabel#1{%
\begingroup
- \enit@refstar\arabic
- \enit@refstar\alph
- \enit@refstar\Alph
- \enit@refstar\roman
- \enit@refstar\Roman
- \enit@refstar\value
- \enit@refstar\@arabic
- \enit@refstar\@alph
- \enit@refstar\@Alph
- \enit@refstar\@roman
- \enit@refstar\@Roman
- \protected@xdef\enit@a{#1}%
- \endgroup}
-
-\def\enit@reflabel#1{%
+ \enit@labellist
+ \protected@xdef\enit@a{{#1}}% Added braces as \ref is in the
+ \endgroup} % global scope.
+
+% #2=0 don't "normalize", =1 "normalize"
+
+\def\enit@reflabel#1#2{%
\def\enit@ref{%
- \ifnum\@enumdepth=\@ne\else % no level 0
- \advance\@enumdepth\@ne
+ \ifnum\enit@depth=\@ne\else % no level 0
+ \advance\enit@depth\@ne
\@namedef{p@\@enumctr}{}% Don't accumulate labels
- \advance\@enumdepth\m@ne
+ \advance\enit@depth\m@ne
+ \fi
+ \ifcase#2%
+ \def\enit@a{{#1}}%
+ \else
+ \enit@normlabel{#1}% Returns \enit@a
\fi
- \enit@normlabel{#1}% Returns \enit@a
\expandafter
\let\csname the\@enumctr\endcsname\enit@a}}
\def\enit@refstar#1{%
\def#1##1{%
\if*##1\@empty
- \noexpand#1{enum\romannumeral\@enumdepth}%
+ \noexpand#1{\@enumctr}%
\else
\noexpand#1{##1}%
\fi}}
\def\enit@setkeys#1{%
\@ifundefined{#1}{}%
- {\toks@\expandafter\expandafter\expandafter
- {\csname#1\endcsname}%
- \edef\enit@a{%
- \noexpand\setkeys{enumitem}{\the\toks@}}%
- \enit@a
- \ifx\enit@ref\relax\else % Not a logical place, grrr
- \let\enit@saveref\enit@ref
- \let\enit@ref\relax
- \fi}}
+ {\expandafter\expandafter\expandafter
+ \enit@setkeys@i\csname#1\endcsname\@@}}
+
+\def\enit@setkeys@i#1\@@{%
+ \@nameuse{enit@shl@\enit@type}{#1}%
+ \expandafter\enit@setkeys@ii\the\enit@toks\@@}
+
+\def\enit@setkeys@ii#1\@@{%
+ \setkeys{enumitem}{#1}%
+ \ifx\enit@ref\relax\else % Not a logical place, grrr
+ \let\enit@saveref\enit@ref
+ \let\enit@ref\relax
+ \fi}
+
+% pre y post code
+
+\define@key{enumitem}{before}[1]{%
+ \def\enit@before{#1}}
+
+\define@key{enumitem}{after}[1]{%
+ \def\enit@after{#1}}
+
+\define@key{enumitem}{before*}[1]{%
+ \expandafter\def\expandafter\enit@before\expandafter
+ {\enit@before#1}}
+
+\define@key{enumitem}{after*}[1]{%
+ \expandafter\def\expandafter\enit@after\expandafter
+ {\enit@after#1}}
% And now, the three environments are redefined.
% First, code shared by enumerate and itemize.
@@ -225,6 +375,8 @@
\def\enit@preset{%
\def\makelabel##1{\hss\llap{\enit@format##1}}%
+ \let\enit@before\@empty
+ \let\enit@after\@empty
\let\enit@format\@empty
\let\enit@calcleft\relax
\let\enit@widest\@empty
@@ -234,17 +386,38 @@
\else
\parindent\enit@outerparindent
\fi
- \enit@setkeys
- {enit@list}%
- \enit@setkeys
- {enit@list\romannumeral\@listdepth}}
-
-\def\enit@enumerate#1{%
- \ifnum \@enumdepth >\thr@@
+ \enit@setkeys{enit@@list}%
+ \enit@setkeys{enit@@list\romannumeral\@listdepth}}
+
+\def\enit@resumeset#1#2{%
+ \def\enit@a{resume*}%
+ \def\enit@b{#2}%
+ \ifx\enit@a\enit@b
+ \enit@toks\expandafter\expandafter\expandafter
+ {\csname enit@savekeys@\@currenvir\endcsname}%
+ \@nameuse{enit@resume@\@currenvir}\relax
+ \else
+ #1{#2}% Returns toks@
+ \fi
+ \edef\enit@c{%
+ \def\noexpand\enit@savekeys{\the\enit@toks}%
+ \noexpand\setkeys{enumitem}{\the\enit@toks}}%
+ \enit@c}
+
+% The following has 4 arguments, which in enumerate are:
+% \@enumdepth, enum, \thr@@, <format>.
+% In user defined environments they are:
+% \enitdp@<name>, <name>, <max-depth>, <format>
+
+\def\enit@enumerate#1#2#3#4{%
+ \def\enit@depth{#1}%
+ \def\enit@type{enum}%
+ \ifnum#1>#3\relax
\@toodeep
\else
- \advance\@enumdepth\@ne
- \edef\@enumctr{enum\romannumeral\@enumdepth}%
+ \edef\enit@prevlabel{#2\romannumeral#1}%
+ \advance#1\@ne
+ \edef\@enumctr{#2\romannumeral#1}%
\expandafter
\list
\csname label\@enumctr\endcsname
@@ -254,70 +427,102 @@
\enit@normlabel{\@itemlabel}% Returns \enit@a
\expandafter\let\@itemlabel\enit@a
\enit@preset
- \enit@setkeys
- {enit@enum}%
- \enit@setkeys
- {enit@\@enumctr}%
- \setkeys{enumitem}{#1}%
+ \enit@setkeys{enit@@#2}%
+ \enit@setkeys{enit@@\@enumctr}%
+ \enit@resumeset\enit@shl@enum{#4}%
\enit@calcleft
\ifx\enit@ref\relax
\enit@saveref
\else
\enit@ref
- \fi}%
+ \fi
+ \enit@before}%
\fi}
\def\enit@endenumerate{%
+ \enit@after
\endlist
- \xdef\enit@resume{%
- \csname c@\@listctr\endcsname
- \the\csname c@\@listctr\endcsname}}
+ \enit@toks\expandafter{\enit@savekeys}%
+ \xdef\enit@afterlist{%
+ \def\expandafter\noexpand
+ \csname enit@savekeys@\@currenvir\endcsname{\the\enit@toks}%
+ \def\expandafter\noexpand
+ \csname enit@resume@\@currenvir\endcsname{%
+ \csname c@\@listctr\endcsname
+ \the\csname c@\@listctr\endcsname}}%
+ \aftergroup\enit@afterlist}
-\renewenvironment{enumerate}[1][]
- {\enit@enumerate{#1}}
- {\enit@endenumerate}
+% The following has 4 arguments, which in itemize are:
+% \@itemdepth, item, \thr@@, <format>.
+% In user defined environments they are:
+% \enitdp@<name>, <name>, <max-depth>, <format>
-\def\enit@itemize#1{%
- \ifnum \@itemdepth >\thr@@
+\def\enit@itemize#1#2#3#4{%
+ \def\enit@depth{#1}%
+ \def\enit@type{item}%
+ \ifnum#1>#3\relax
\@toodeep
\else
- \advance\@itemdepth\@ne
- \edef\@itemitem{labelitem\romannumeral\@itemdepth}%
+ \edef\enit@prevlabel{#2\romannumeral#1}%
+ \advance#1\@ne
+ \edef\@itemitem{label#2\romannumeral#1}%
\expandafter
\list
\csname\@itemitem\endcsname
{\enit@preset
- \enit@setkeys
- {enit@item}%
- \enit@setkeys
- {enit@item\romannumeral\@itemdepth}%
- \setkeys{enumitem}{#1}%
- \enit@calcleft}%
+ \enit@setkeys{enit@@#2}%
+ \enit@setkeys{enit@@#2\romannumeral#1}%
+ \enit@resumeset\enit@shl@item{#4}%
+ \enit@calcleft
+ \enit@before}%
\fi}
-
-\let\enit@enditemize\itemize
-\renewcommand{\itemize}[1][]{\enit@itemize{#1}}
-
-\renewcommand{\description}[1][]{%
- \list{}%
- {\labelwidth\z@
- \let\makelabel\descriptionlabel
- \let\enit@descstyle\enit@normalstyle
- \let\enit@format\@empty
- \labelindent\z@skip
- \enit@setkeys
- {enit@list}%
- \enit@setkeys
- {enit@list\romannumeral\@listdepth}%
- \enit@setkeys
- {enit@desc}%
- \setkeys{enumitem}{#1}%
- \itemindent-\leftmargin
- \advance\itemindent\labelindent
- \let\enit@makelabel\makelabel
- \def\makelabel##1{%
- \enit@descstyle{\enit@makelabel{\enit@format##1}}}}}
+\def\enit@enditemize{%
+ \enit@after
+ \endlist
+ \enit@toks\expandafter{\enit@savekeys}%
+ \xdef\enit@afterlist{%
+ \def\expandafter\noexpand
+ \csname enit@savekeys@\@currenvir\endcsname{\the\enit@toks}}%
+ \aftergroup\enit@afterlist}
+
+\def\enit@description#1#2#3#4{%
+ \def\enit@depth{#1}%
+ \def\enit@type{desc}%
+ \ifnum#1>#3\relax
+ \@toodeep
+ \else
+ \list{}%
+ {\labelwidth\z@
+ \let\makelabel\descriptionlabel
+ \let\enit@descstyle\enit@normalstyle
+ \let\enit@before\@empty
+ \let\enit@after\@empty
+ \let\enit@format\@empty
+ \labelindent\z@skip
+ \enit@setkeys{enit@@list}%
+ \enit@setkeys{enit@@list\romannumeral#1}%
+ \enit@setkeys{enit@@#2}%
+ \enit@resumeset\enit@toks{#4}%
+ \itemindent-\leftmargin
+ \advance\itemindent\labelindent
+ \let\enit@makelabel\makelabel
+ \def\makelabel##1{%
+ \enit@descstyle{\enit@makelabel{\enit@format##1}}}%
+ \enit@before}%
+ \fi}
+
+\newcount\enitdp@desc
+\enitdp@desc\z@
+
+\def\enit@enddescription{%
+ \enit@after
+ \endlist
+ \enit@toks\expandafter{\enit@savekeys}%
+ \xdef\enit@afterlist{%
+ \def\expandafter\noexpand
+ \csname enit@savekeys@\@currenvir\endcsname{\the\enit@toks}}%
+ \aftergroup\enit@afterlist}
% Option ignoredisplayed (see below).
@@ -325,10 +530,8 @@
\parsep\parskip
\csname @list\romannumeral\the\@listdepth\endcsname
\@nmbrlistfalse
- \enit@setkeys
- {enit@triv}%
- \enit@setkeys
- {enit@triv\romannumeral\@listdepth}%
+ \enit@setkeys{enit@@triv}%
+ \enit@setkeys{enit@@triv\romannumeral\@listdepth}%
\@trivlist
\labelwidth\z@
\leftmargin\z@
@@ -347,9 +550,20 @@
% Here, the \everypar in \@item is overriden
% and the label is printed directly, without
% boxing it.
+%
+% First, a utility macro
+
+\def\enit@break{%
+ \if@nobreak
+ \@nobreakfalse
+ \clubpenalty\@M
+ \else
+ \clubpenalty\@clubpenalty
+ \everypar{}%
+ \fi}
\def\enit@nextlinestyle#1{%
- \hskip-\itemindent % quick & dirty --what's happening?
+ \hskip-\itemindent
\global\everypar{%
\@minipagefalse
\global\@newlistfalse
@@ -374,13 +588,7 @@
\hskip\leftmargin\hskip\labelsep\hskip-\labelindent
\fi}%
\fi
- \if@nobreak
- \@nobreakfalse
- \clubpenalty \@M
- \else
- \clubpenalty \@clubpenalty
- \everypar{}%
- \fi}}
+ \enit@break}}
\def\enit@multilinestyle#1{%
\dimen@\leftmargin
@@ -403,18 +611,12 @@
{\setbox\z@\lastbox
\ifvoid\z@
\kern-\itemindent
- \fi%
+ \fi
\hskip-\leftmargin\hskip-\labelsep\hskip\labelindent
#1%
\hskip\labelsep}%
\fi
- \if@nobreak
- \@nobreakfalse
- \clubpenalty \@M
- \else
- \clubpenalty \@clubpenalty
- \global\everypar{}%
- \fi}}
+ \enit@break}}
\def\enit@samelinestyle#1{%
\hskip-\itemindent
@@ -444,29 +646,32 @@
\hskip-\labelindent
\fi}%
\fi
- \if@nobreak
- \@nobreakfalse
- \clubpenalty \@M
- \else
- \clubpenalty \@clubpenalty
- \everypar{}%
- \fi}}
+ \enit@break}}
-% Formatting lists globally
+% Formatting lists globally. Note \romannumeral0 expands
+% to nothing.
\newcommand\setenumerate[1][0]{%
- \expandafter\def\csname enit@enum\romannumeral#1\endcsname}
+ \expandafter\def\csname enit@@enum\romannumeral#1\endcsname}
\newcommand\setitemize[1][0]{%
- \expandafter\def\csname enit@item\romannumeral#1\endcsname}
+ \expandafter\def\csname enit@@item\romannumeral#1\endcsname}
+
+\newcommand\setdescription{\def\enit@@desc}
-\def\setdescription{\def\enit@desc}
+% task: more robust test
\newcommand\setlist[1][0]{%
- \expandafter\def\csname enit@list\romannumeral#1\endcsname}
+ \def\enit@b{list}%
+ \count@\z@\relax
+ \@for\enit@a:=#1\do{%
+ \@ifundefined{end\enit@a}%
+ {\count@=\enit@a}%
+ {\edef\enit@b{\enit@a}}}%
+ \expandafter\def\csname enit@@\enit@b\romannumeral\count@\endcsname}
\newcommand\setdisplayed[1][0]{%
- \expandafter\def\csname enit@triv\romannumeral#1\endcsname}
+ \expandafter\def\csname enit@@triv\romannumeral#1\endcsname}
% A few useful predefined keys
@@ -485,13 +690,90 @@
\labelwidth\z@
\def\makelabel##1{%
\hskip\labelsep\enit@format##1}}
+
+% User defined enumerate and itemize
+
+\def\enit@xset@itemize#1#2{%
+ \@namedef{label#1\romannumeral\count@}{%
+ \PackageError{enumitem}{Undefined label}%
+ {You have defined a list, but labels have
+ not been setup.\MessageBreak Use the label field.}}}
+
+\def\enit@xset@enumerate#1#2{%
+ \enit@xset@itemize{#1}{#2}%
+ \@definecounter{#1\romannumeral\count@}}
+
+\let\enit@xset@description\@gobbletwo
+
+% <new/renew>, <name>, <type>, <max-depth>
+
+\def\enit@newlist#1#2#3#4{%
+ \count@\@ne
+ \loop
+ \@nameuse{enit@xset@#3}{#2}{#4}%
+ \ifnum\count@<#4
+ \advance\count@\@ne
+ \repeat
+ \@ifundefined{enitdp@#2}%
+ {\expandafter\newcount\csname enitdp@#2\endcsname}{}%
+ \csname enitdp@#2\endcsname\z@
+ \count@#4
+ \advance\count@\m@ne
+ \edef\enit@a{%
+ \noexpand#1{#2}[1][]%
+ {\noexpand\enit@checkenv{#2}%
+ \expandafter\noexpand\csname enit@#3\endcsname
+ \expandafter\noexpand\csname enitdp@#2\endcsname
+ {#2}%
+ {\the\count@}%
+ {####1}}%
+ {\expandafter\noexpand\csname enit@end#3\endcsname}}%
+ \enit@a}
+
+
+\newcommand\newlist{\enit@newlist\newenvironment}
+\newcommand\renewlist{\enit@newlist\renewenvironment}
+
+\def\enit@checkenv#1{%
+ \def\enit@a{#1}%
+ \ifx\enit@a\@currenvir\else
+ \PackageError{enumitem}{Bad nesting}%
+ {You are using a non grouping form of a list
+ environment.\MessageBreak
+ Use \string\begin/\string\end.}%
+ \fi}%
% And options
+\newif\ifenit@loadonly
+
\DeclareOption{ignoredisplayed}{\let\enit@trivlist\trivlist}
+\DeclareOption{loadonly}{\enit@loadonlytrue}
+\DeclareOption{shortlabels}
+ {\def\enit@shl@enum#1{%
+ \def\enit@c{#1}%
+ \enit@first#1,\@nil\@@nil}%
+ \let\enit@shl@item\enit@shl@enum}
\ProcessOptions
\let\trivlist\enit@trivlist
+\ifenit@loadonly\else
+
+\renewenvironment{enumerate}[1][]
+ {\enit@enumerate\@enumdepth{enum}\thr@@{#1}}
+ {\enit@endenumerate}
+
+\renewenvironment{itemize}[1][]
+ {\enit@itemize\@itemdepth{item}\thr@@{#1}}
+ {\enit@enditemize}
+
+\renewenvironment{description}[1][]
+ {\enit@description\z@{desc}\@M{#1}}
+ {\enit@enddescription}
+
+\fi
+
+
\endinput