summaryrefslogtreecommitdiff
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
parentcc6f0e9093f42daa94cdf4d28f883cf4f10bdf42 (diff)
enumitem 2.0 (12mar07)
git-svn-id: svn://tug.org/texlive/trunk@4055 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/enumitem/README51
-rw-r--r--Master/texmf-dist/doc/latex/enumitem/enumitem.pdfbin157701 -> 123875 bytes
-rw-r--r--Master/texmf-dist/doc/latex/enumitem/enumitem.tex165
-rw-r--r--Master/texmf-dist/tex/latex/enumitem/enumitem.sty556
-rw-r--r--Master/texmf-dist/tpm/enumitem.tpm6
5 files changed, 588 insertions, 190 deletions
diff --git a/Master/texmf-dist/doc/latex/enumitem/README b/Master/texmf-dist/doc/latex/enumitem/README
index 2d786d62ab0..22cbc14918c 100644
--- a/Master/texmf-dist/doc/latex/enumitem/README
+++ b/Master/texmf-dist/doc/latex/enumitem/README
@@ -1,25 +1,26 @@
-Enumitem
-~~~~~~~~
-
-A package to customize the three basic lists (enumerate,
-itemize and description) by means of a set of parameters.
-It provides most of the flexibility you may want to
-design your own lists:
-- fancy labels and fancy refs,
-- leftmargin, labelsep and labelwidth automatically set,
-- changes applied globally or only in one of the three
- types or even in a single list (including topsep) by
- means of a sort of "inheritance",
-- several description styles (which fix some bad
- spacing, too),
-- starting value and counter resuming,
-- trivlists properly formatted,
-- control on page breaking
-
-_________________________________________________________________
-Javier Bezos | http://www.texytipografia.com
-.................................................................
-2005/05/12
-
-
-
+Enumitem
+~~~~~~~~
+
+A package to customize the three basic lists (enumerate,
+itemize and description) by means of a set of parameters,
+and to clone them to define new "logical" lists.
+It provides most of the flexibility you may want to
+design your own lists:
+- fancy labels and fancy refs,
+- leftmargin, labelsep and labelwidth automatically set,
+- changes applied globally or only in one of the three
+ types or even in a single list (including topsep) by
+ means of a sort of "inheritance",
+- several description styles (which fix some bad
+ spacing, too),
+- starting value and counter resuming,
+- trivlists properly formatted,
+- control on page breaking
+
+_________________________________________________________________
+Javier Bezos | http://www.texytipografia.com
+.................................................................
+2007/03/12
+
+
+
diff --git a/Master/texmf-dist/doc/latex/enumitem/enumitem.pdf b/Master/texmf-dist/doc/latex/enumitem/enumitem.pdf
index 6ece7e8a8ae..14ac443b0a2 100644
--- a/Master/texmf-dist/doc/latex/enumitem/enumitem.pdf
+++ b/Master/texmf-dist/doc/latex/enumitem/enumitem.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/enumitem/enumitem.tex b/Master/texmf-dist/doc/latex/enumitem/enumitem.tex
index 9a638da77c8..d183f61329d 100644
--- a/Master/texmf-dist/doc/latex/enumitem/enumitem.tex
+++ b/Master/texmf-dist/doc/latex/enumitem/enumitem.tex
@@ -1,19 +1,42 @@
+% +--------------------------------------------------+
+% | Typeset this file to document enumitem.sty |
+% +--------------------------------------------------+
+%
+% Copyright (c) 2003-2007 by Javier Bezos.
+% All Rights Reserved.
+%
+% This file is part of the enumitem distribution release 2.0
+% -----------------------------------------------------------
+%
+% 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.
+
\documentclass{article}
\usepackage{hyperref}
+%\usepackage{pslatex}
+
\title{Customizing lists\\with the\\\textsf{enumitem} package}
\author{Javier Bezos\footnote{For bug reports, comments and
-suggestions go to \href{http://www.texytipografia.com/contact.php}%
-{http://www.texytipografia.com/contact.php}, or
-to my postal address: Apartado 116.035, E-28080 Madrid, Spain.
+suggestions go to \href{http://www.texytipografia.com/contact.html}%
+{http://www.texytipografia.com/contact.html}.
English is not my strong point, so contact me when you
find mistakes in the manual. Other packages by the same author:
\textsf{gloss} (with Jos\'e Luis D\'{\i}az), \textsf{accents,
tensind, esindex, dotlessi, titlesec, titletoc}.}}
-\date{Version 1.1\\2005/05/12}
+\date{Version 2.0\\2007/03/12}
\IfFileExists{enumitem.sty}{\usepackage{enumitem}}{}
@@ -110,7 +133,6 @@ described below.
The following new parameters are provided:
\begin{itemize}
-
\item \verb|font|. Sets the label font. Useful when the label is
changed with the optional argument of \verb|\item|.
@@ -135,6 +157,15 @@ to illustrate what is possible; requires \textsf{color} and
start=172]
\end{verbatim}
+\item \verb|label*| is like \verb|label| but its value is appended to
+the current label. For example, the follollowing defines a
+\verb|legal| list (1., 1.1., 1.1.1., and so on):
+\begin{verbatim}
+\newlist{legal}{enumerate}{10}
+\setlist[legal]{label*=\arabic*.}
+\end{verbatim}
+
+
\item \verb|ref|. By default, \verb|label| sets also the form of cross
references and \verb|\the...|, but you can define a
different format. For
@@ -295,6 +326,11 @@ Text.
\end{enumerate}
\end{verbatim}
+\item \verb|resume*| is like \verb|resume| but the options from the
+previous list are used, too. This option must be restricted to the
+optional argument in a environment (this is the only place where it
+makes sense) and further keys are not allowed.
+
\item \verb|beginpenalty|, \verb|midpenalty| and \verb|endpenalty| set
the penalty at the beginning of a list, between items and at the end
of the list. Please, refer to your \LaTeX{} or \TeX{} manual about
@@ -302,6 +338,17 @@ how penalties control page breaks. Unlike other parameters, when a
list starts their values are not reset to the default, thus they
apply to the enclosed lists, too.
+\item \verb|before| and \verb|before*| executes code before the list
+starts (more precisely, in the second argument of the \verb|list|
+environment used to define them). The former sets the code to be
+executed, overriding any previous value, while the starred form adds
+the code to the existing one (in the setting hierarchy, see below,
+\textit{not} with relation to the enclosing list). It can contain,
+say, rules and text, but this has not been extensively tested.
+
+\item \verb|after| and \verb|after*| is the same but just before
+the list ends.
+
\end{itemize}
A key are available in \verb|description|
@@ -385,6 +432,90 @@ No attempt has been made (yet) to discriminate the font size
(\verb|\normalsize|, \verb|\small|\dots). Suggestions are
most welcome.
+\subsection{\textsf{enumerate}-like labels}
+
+With the package option \texttt{shortlabels} you can use an
+\textsf{enumerate}-like syntax, where \verb|A|, \verb|a|, \verb|I|,
+\verb|i| and \verb|1| stand for \verb|\Alph*|, \verb|\alph*|,
+\verb|\Roman*|, \verb|\roman*| and \verb|\arabic*|. This is intended
+mainly as a sort of compatibility mode with the \textsf{enumerate}
+package, and therefore the following special rule applies: if the very
+first option (at any level) is not recognized as a valid key, then it
+will be considered a label with the \textsf{enumerate}-like syntax. For
+example:
+\begin{verbatim}
+\begin{enumerate}[i), labelindent=\parindent]
+...
+\end{enumerate}
+\end{verbatim}
+Although perhaps not so useful, you can omit \verb|label=| in the
+itemize environment under similar conditions, too:
+\begin{verbatim}
+\begin{itemize}[\textbullet]
+...
+\end{itemize}
+\end{verbatim}
+
+In addition, you can define new keys (or redefine them), which is
+particularly useful for enumerate to be adapted to especific
+typographical rules or to extend it for non-Latin scrips:
+\begin{verbatim}
+\SetEnumerateShortLabel{<key>}{<replacement>}
+\end{verbatim}
+where \verb|<replacement>| contains one of the starred versions of
+counters. For example:
+\begin{verbatim}
+\SetEnumerateShortLabel{i}{\textsc{\roman*}}
+\end{verbatim}
+redefines \verb|i| so that items using this key are numbered with
+small caps roman numerals.
+
+\subsection{Cloning the three basic lists}
+
+As of version 2.0 the three lists can be cloned so that you can
+define ``logical'' environments behaving like them. To define a
+new lists (or redefine a existing one), use \verb|\newlist| (or
+\verb|\renewlist|), which the following syntax:
+\begin{verbatim}
+\newlist{<name>}{<type>}{<max-depth>}
+\end{verbatim}
+where \verb|<type>| is \verb|enumerate|, \verb|itemize| or
+\verb|description|. Then you can (in fact you must, at least the
+label) set the new list with \verb|\setlist|:
+\begin{verbatim}
+\newlist{ingredients}{itemize}{1}
+\setlist[ingredients]{label=\textbullet}
+\newlist{steps}{enumerate}{2}
+\setlist[steps,1]{label=(\arabic*)}
+\setlist[steps,2]{label=(\arabic*)}
+\end{verbatim}
+The optional argument of \verb|\setlist| has an extended
+syntax---names say which lists applies the settings to, and numbers
+the level. Do not use this syntax in the three basic lists, but that
+above, except if you redefine them.
+
+\subsection{New counters}
+
+With
+\begin{verbatim}
+\AddEnumerateCounter{<LaTeX counter>}{<TeX count>}{<widest label>}
+\end{verbatim}
+a counter representation is ``registered'' so that \textsf{enumitem}
+recognizes it. Intended mainly for non Latin scripts, but also useful
+in Latin scripts. For example:
+\begin{verbatim}
+\def\ctext#1{\expandafter\@ctext\csname c@#1\endcsname}
+\def\@ctext#1{\ifcase#1\or First\or Second\or Third\or
+Fourth\or Fifth\or Sixth\fi}
+\AddEnumerateCounter{\ctext}{\@ctext}{Second}
+\end{verbatim}
+
+\subsection{Package option \texttt{loadonly}}
+
+With this package option the package is loaded but the three
+lists are not redefined. You can create your own lists, yet, or
+even redefine the existing ones.
+
\section{Three patterns}
Three list layouts could be considered very
@@ -440,7 +571,7 @@ to normal paragraphs.
\verb|quote|, etc., even if conceptually they are not lists.
Unfortunately, \verb|trivlist| uses the current list settings, which
has the odd side effect that changing the vertical spacing of lists
-also changes the spacing in these environments.
+also changes sometimes the spacing in these environments.
This package modifies \verb|trivlist| so that the default settings for
the current level (ie, those set by the corresponding \verb|clo|
@@ -680,7 +811,6 @@ noches, duelos y quebrantos los s\'{a}bados...
\hrule
\vskip6pt
-
Same, but with \verb|multiline|. Note the text overlaps if
the item body is too short.
@@ -744,25 +874,10 @@ development of this package has to take it into account.
\subsection{Known issues}
-Description styles othen than the default one don't group
+Description styles other than the default one don't group
labels if they are nested.
-\subsection{Changes in 0.2}
-
-If you were using the beta release 0.1, please note version 0.2
-introduced several modifications, which also applies to this
-first release. The main change is a new syntax for
-\verb|calcsep| and \verb|calcmargin|, but modifying the current files
-is trivial with find and replace (if applied in the given order):
-\begin{itemize}
-\item
-\verb|calcmargin=| becomes \verb|leftmargin=*,widest=|
-\item
-\verb|calcmargin| becomes \verb|leftmargin=*|
-\item
-\verb|calcsep=| becomes \verb|labelsep=*,widest=|
-\item
-\verb|calcsep| becomes \verb|labelsep=*|
-\end{itemize}
+You must use the \LaTeX{} syntax for environments, with \verb|\begin|
+and \verb|\end|.
\end{document}
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
diff --git a/Master/texmf-dist/tpm/enumitem.tpm b/Master/texmf-dist/tpm/enumitem.tpm
index 5ab454bc9ac..d5cb0790c6e 100644
--- a/Master/texmf-dist/tpm/enumitem.tpm
+++ b/Master/texmf-dist/tpm/enumitem.tpm
@@ -3,7 +3,7 @@
<rdf:Description about="http://texlive.dante.de/texlive/Package/enumitem.zip">
<TPM:Name>enumitem</TPM:Name>
<TPM:Type>Package</TPM:Type>
- <TPM:Date>2006/01/09 00:44:40</TPM:Date>
+ <TPM:Date>2007/03/12 19:10:00</TPM:Date>
<TPM:Version>2005/05/12 v1.1</TPM:Version>
<TPM:Creator>rahtz</TPM:Creator>
<TPM:Title>
@@ -20,11 +20,11 @@ the item separation or the left margin.
<TPM:Size>197815</TPM:Size>
<TPM:License></TPM:License>
<TPM:Build/>
- <TPM:RunFiles size="13330">
+ <TPM:RunFiles size="20930">
texmf-dist/tex/latex/enumitem/enumitem.sty
texmf-dist/tpm/enumitem.tpm
</TPM:RunFiles>
- <TPM:DocFiles size="184485">
+ <TPM:DocFiles size="155181">
texmf-dist/doc/latex/enumitem/README
texmf-dist/doc/latex/enumitem/enumitem.pdf
texmf-dist/doc/latex/enumitem/enumitem.tex