summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/enumitem
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-14 22:05:41 +0000
committerKarl Berry <karl@freefriends.org>2019-01-14 22:05:41 +0000
commit476c59429d32e613e223cab375c292ffddcdaa8d (patch)
tree7f1aeb9291e6b89e0f67751160a70392402f4931 /Master/texmf-dist/tex/latex/enumitem
parentf7f1f807d00177577e28ff9d0992e86659b5997f (diff)
enumitem (14jan19)
git-svn-id: svn://tug.org/texlive/trunk@49702 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/enumitem')
-rw-r--r--Master/texmf-dist/tex/latex/enumitem/enumitem.sty395
1 files changed, 228 insertions, 167 deletions
diff --git a/Master/texmf-dist/tex/latex/enumitem/enumitem.sty b/Master/texmf-dist/tex/latex/enumitem/enumitem.sty
index 9269843da11..9ff077e45ff 100644
--- a/Master/texmf-dist/tex/latex/enumitem/enumitem.sty
+++ b/Master/texmf-dist/tex/latex/enumitem/enumitem.sty
@@ -1,5 +1,5 @@
%
-% Copyright (C) 2003-2018 Javier Bezos http://www.texnia.com
+% Copyright (C) 2003-2019 Javier Bezos http://www.texnia.com
%
% This file may be distributed and/or modified under the conditions of
% the MIT License. A version can be found at the end of this file.
@@ -10,7 +10,7 @@
% ~~~~~~~
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{enumitem}[2018/11/30 v3.6 Customized lists]
+\ProvidesPackage{enumitem}[2019/01/14 v3.7 Customized lists]
% Notes
% ~~~~~
@@ -20,8 +20,6 @@
% To do:
% ~~~~~~
% - ref*, for adding stuff in the same fashion as label*
-% - option ams, to force upshape, but I have to investigate
-% how to do it.
% - labelled descriptions (ie, label, title, body)
% - A true nextline (far from trivial and perhaps solved with
% labelled descriptions).
@@ -31,19 +29,22 @@
% - \@enumctr <-> \@listctr?
% - Define keys with values
% - Revise @nobreak
+% - bottomsep
+% - \SetEnumerateCounter - must define syntax
+% - option verbose
+% - collect sizes in \SetEnumitemSizes?
+% - series=explicit / resume
+% - package option inlinenew, to define "new" inline lists
%
% +=============================+
% | EMULATING KEYVAL |
% +=============================+
%
-% "Thanks" to xkeyval, which uses the same macro names as
-% keyval :-(, the latter has to be replicated in full here
-% to ensure it works as intended. The original work is by
-% David Carlisle, under license LPPL. Once the code is here,
-% it could be optimized by adapting it to the specific needs
-% of enumitem (to do).
-
-% TODO - Update to the latest changes in keyval
+% "Thanks" to xkeyval, which uses the same macro names as keyval :-(,
+% the latter has to be replicated in full here to ensure it works as
+% intended. The original work is by David Carlisle, under license LPPL.
+% Once the code is here, it could be optimized by adapting it to the
+% specific needs of enumitem (to do).
\def\enitkv@setkeys#1#2{%
\def\enitkv@prefix{enitkv@#1@}%
@@ -76,7 +77,7 @@
\expandafter\let\expandafter\@tempb
\csname\enitkv@prefix\@tempa @default\endcsname
\ifx\@tempb\relax
- \enitkv@err{No value specified for \@tempa}%
+ \enitkv@err{No value specified for \@tempa}%
\else
\@tempb\relax
\fi}
@@ -105,7 +106,9 @@
{\let\enitkv@toks@\KV@toks@}
\def\enitkv@key#1#2{%
- \@ifnextchar[{\enitkv@def{#1}{#2}}{\@namedef{enitkv@#1@#2}####1}}
+ \@ifnextchar[%
+ {\enitkv@def{enumitem#1}{#2}}%
+ {\@namedef{enitkv@enumitem#1@#2}####1}}
\def\enitkv@def#1#2[#3]{%
\@namedef{enitkv@#1@#2@default\expandafter}\expandafter
@@ -122,8 +125,8 @@
% safe side, instead of \toks@, etc., a new one is declared.
% (2) \enit@inbox is the box storing the items in boxed inline
% lists.
-% (3) \enit@outerparindent is used to save the outer parindent
-% so that it can be used in the key parindent
+% (3) \enit@outerparindent is used to save the outer parindent
+% so that it can be used in the key parindent
% (4) \enit@type has three values: 0 = enum, 1 = item, 2 = desc.
% (5) \enit@calc stores which dimen is to be computed:
% 0=labelindent, 1=labelwidth, 2=labelsep, 3=leftmargin,
@@ -179,30 +182,30 @@
\def\enit@error{\PackageError{enumitem}}
\def\enit@checkerror#1#2{%
- \enit@error{Unknown value `#2' for key `#1'}%
- {See the manual for valid values}}
+ \enit@error{Unknown value '#2' for key '#1'}%
+ {See the manual for valid values}}
\def\enit@itemerror{%
\enit@error{Misplaced \string\item}%
{Either there is some text before the first\MessageBreak
- item or the last item has no text}}
+ item or the last item has no text}}
\def\enit@noserieserror#1{%
- \enit@error{Series `#1' not started}%
+ \enit@error{Series '#1' not started}%
{You are trying to continue a series\MessageBreak
- which has not been started with series}}
+ which has not been started with 'series'}}
\def\enit@checkseries#1{%
\ifcase\enit@resuming
- \enit@error{Misplaced key `#1'}%
- {`series' and `resume*' must be used\MessageBreak
+ \enit@error{Misplaced key '#1'}%
+ {'series' and 'resume*' must be used\MessageBreak
in the optional argument of lists}%
\fi}
\def\enit@checkseries@m{%
\ifcase\enit@resuming\else
\enit@error{Uncompatible series settings}%
- {`series' and `resume*' must not be used\MessageBreak
+ {'series' and 'resume*' must not be used\MessageBreak
at the same time}%
\fi}
@@ -227,31 +230,27 @@
% Including code executed by keys.
%
% There are 2 keyval groups: enumitem, and enumitem-delayed.
-% The latter is used to make sure a prioritary key is the
-% latest one; eg, ref, so that the ref format set by label
-% is overriden. So, when this key is found in enumitem,
-% nothing is done, except the key/value is moved to
-% enumitem-delayed.
+% The latter is used to make sure a prioritary key is the latest one;
+% eg, ref, so that the ref format set by label is overriden. So, when
+% this key is found in enumitem, nothing is done, except the key/value
+% is moved to enumitem-delayed.
%
-% A further group (enumitem-resume) catches resume* and
-% series in optional arguments in lists.
+% A further group (enumitem-resume) catches resume* and series in
+% optional arguments in lists.
%
% Vertical spacing
% ================
-\enitkv@key{enumitem}{topsep}{%
+\enitkv@key{}{topsep}{%
\enit@setlength\topsep{#1}}
-% \enitkv@key{enumitem}{bottomsep}{%
- % \def\enit@bottomsep{#1}}
-
-\enitkv@key{enumitem}{itemsep}{%
+\enitkv@key{}{itemsep}{%
\enit@setlength\itemsep{#1}}
-\enitkv@key{enumitem}{parsep}{%
+\enitkv@key{}{parsep}{%
\enit@setlength\parsep{#1}}
-\enitkv@key{enumitem}{partopsep}{%
+\enitkv@key{}{partopsep}{%
\enit@setlength\partopsep{#1}}
% Horizontal spacing
@@ -278,10 +277,6 @@
\fi\fi}
\def\enitkv@enumitem@widest#1{%
- \expandafter\let\csname enit@cw@\@enumctr\endcsname\relax
- \@namedef{enit@widest@\@enumctr}##1{#1}}
-
-\def\enitkv@enumitem@widest#1{%
\ifcase\enit@type % enumerate
\expandafter\let\csname enit@cw@\@enumctr\endcsname\relax
\@namedef{enit@widest@\@enumctr}##1{\enit@format{#1}}%
@@ -293,14 +288,14 @@
\expandafter\let\csname enit@cw@\@enumctr\endcsname\relax
\expandafter\let\csname enit@widest@\@enumctr\endcsname\relax}
-\enitkv@key{enumitem}{widest*}{%
+\enitkv@key{}{widest*}{%
\setcounter{enit@cnt}{#1}%
\expandafter\edef\csname enit@cw@\@enumctr\endcsname
{\the\c@enit@cnt}%
\expandafter\edef\csname enit@widest@\@enumctr\endcsname##1%
{##1{\the\c@enit@cnt}}}
-\enitkv@key{enumitem}{labelindent*}{%
+\enitkv@key{}{labelindent*}{%
\enit@lblfrommargintrue
\ifnum\enit@calc=\z@
\enit@calcwidestfalse
@@ -308,14 +303,14 @@
\enit@setlength\labelindent{#1}%
\advance\labelindent\leftmargin}
-\enitkv@key{enumitem}{labelindent}{%
+\enitkv@key{}{labelindent}{%
\enit@lblfrommarginfalse
\enit@calcset\labelindent\z@{#1}}
-\enitkv@key{enumitem}{labelwidth}{%
+\enitkv@key{}{labelwidth}{%
\enit@calcset\labelwidth\@ne{#1}}
-\enitkv@key{enumitem}{leftmargin}{%
+\enitkv@key{}{leftmargin}{%
\edef\enit@c{\the\leftmargin}%
\enit@calcset\leftmargin\thr@@{#1}%
\ifenit@lblfrommargin
@@ -323,7 +318,7 @@
\advance\labelindent\leftmargin
\fi}
-\enitkv@key{enumitem}{itemindent}{%
+\enitkv@key{}{itemindent}{%
\edef\enit@c{\the\itemindent}%
\enit@calcset\itemindent\enit@iv{#1}%
\ifenit@sepfrommargin
@@ -331,15 +326,15 @@
\advance\labelsep\itemindent
\fi}
-\enitkv@key{enumitem}{listparindent}{%
+\enitkv@key{}{listparindent}{%
\enit@setlength\listparindent{#1}}
-\enitkv@key{enumitem}{rightmargin}{%
+\enitkv@key{}{rightmargin}{%
\enit@setlength\rightmargin{#1}}
% labelsep, from itemindent; labelsep*, from leftmargin
-\enitkv@key{enumitem}{labelsep*}{%
+\enitkv@key{}{labelsep*}{%
\enit@sepfrommargintrue
\ifnum\enit@calc=\tw@
\enit@calcwidestfalse
@@ -348,11 +343,11 @@
\enit@setlength\labelsep{#1}%
\advance\labelsep\itemindent}
-\enitkv@key{enumitem}{labelsep}{%
+\enitkv@key{}{labelsep}{%
\enit@sepfrommarginfalse
\enit@calcset\labelsep\tw@{#1}}
-\enitkv@key{enumitem}{left}{%
+\enitkv@key{}{left}{%
\enit@setleft#1..\@empty..\@@}
\def\enit@setleft#1..#2..#3\@@{%
@@ -368,15 +363,24 @@
% Series, resume and start
% ========================
-\enitkv@key{enumitem-resume}{series}{%
+\enitkv@key{-resume}{series}{%
\enit@checkseries@m
- \let\enit@resuming\@ne
- \enit@ifunset{enitkv@enumitem@#1}{}%
- {\enit@error{Invalid series name `#1'}%
- {Do not name a series with an existing key}}%
+ \let\enit@resuming\@ne %%% TODO - default check also \Set..Key
+ \ifcase\enit@seriesopt
+ \enit@ifunset{enitkv@enumitem@#1}{}%
+ {\enit@error
+ {Invalid series name '#1'}%
+ {Do not name a series with an existing key}}%
+ \else % series=override
+ \global\@namedef{enitkv@enumitem@#1}% with value
+ {\enit@error
+ {Key '#1' has been overriden by a series}%
+ {Change the series name and/or deactivate series=override}}%
+ \global\@namedef{enitkv@enumitem@#1@default}{}%
+ \fi
\def\enit@series{#1}}
-\enitkv@key{enumitem}{series}{%
+\enitkv@key{}{series}{%
\enit@checkseries{series}}
\def\enitkv@enumitem@resume#1{%
@@ -401,45 +405,45 @@
\csname enit@resumekeys@\@currenvir\endcsname
\@nameuse{enit@resume@\@currenvir}\relax}
-\enitkv@key{enumitem}{resume*}[]{%
+\enitkv@key{}{resume*}[]{%
\enit@checkseries{resume*}}
\newcommand\restartlist[1]{%
\enit@ifunset{end#1}%
- {\enit@error{Undefined list `#1'}%
+ {\enit@error{Undefined list '#1'}%
{No list has been defined with that name.}}%
{\expandafter\let
\csname enit@resume@#1\endcsname\@empty}}
-\enitkv@key{enumitem}{start}[\@ne]{%
+\enitkv@key{}{start}[\@ne]{%
\setcounter{\@listctr}{#1}%
\advance\@nameuse{c@\@listctr}\m@ne}
% Penalties
% =========
-\enitkv@key{enumitem}{beginpenalty}{%
+\enitkv@key{}{beginpenalty}{%
\@beginparpenalty#1\relax}
-\enitkv@key{enumitem}{midpenalty}{%
+\enitkv@key{}{midpenalty}{%
\@itempenalty#1\relax}
-\enitkv@key{enumitem}{endpenalty}{%
+\enitkv@key{}{endpenalty}{%
\@endparpenalty#1\relax}
% Font/Format
% ===========
-\enitkv@key{enumitem}{format}{%
+\enitkv@key{}{format}{%
\def\enit@format{#1}}
-\enitkv@key{enumitem}{font}{%
+\enitkv@key{}{font}{%
\def\enit@format{#1}}
% Description styles
% ==================
-\enitkv@key{enumitem}{style}[normal]{%
+\enitkv@key{}{style}[normal]{%
\enit@ifunset{enit@style@#1}%
{\enit@checkerror{style}{#1}}%
{\enit@nextlinefalse
@@ -473,7 +477,7 @@
% Aligment
% --------
-\enitkv@key{enumitem}{align}{%
+\enitkv@key{}{align}{%
\enit@ifunset{enit@align@#1}%
{\enit@checkerror{align}{#1}}%
{\csname enit@align@#1\endcsname}}
@@ -502,11 +506,11 @@
% (2) set ref to @itemlabel, if there is label but not ref
% (3) set ref to ref, if there is ref (with or without label)
-\enitkv@key{enumitem}{label}{%
+\enitkv@key{}{label}{%
\expandafter\def\@itemlabel{#1}%
\def\enit@ref{\expandafter\enit@reflabel\@itemlabel\z@}}
-\enitkv@key{enumitem}{label*}{%
+\enitkv@key{}{label*}{%
\ifnum\enit@depth=\@ne
\expandafter\def\@itemlabel{#1}%
\else % no level 0
@@ -515,19 +519,19 @@
\expandafter\edef\@itemlabel{%
\enit@noexcs{label\enit@prevlabel}%
\the\enit@toks}%
- \advance\enit@depth\@ne
+ \advance\enit@depth\@ne
\fi
\def\enit@ref{\expandafter\enit@reflabel\@itemlabel\z@}}
-% ref is set by label, except if there is an explicit ref
-% in the same hierarchy level. Explicit refs above the
-% current hierarchy level are overriden by label (besides ref),
-% too. Since an explicit ref has preference, it's delayed.
+% ref is set by label, except if there is an explicit ref in the same
+% hierarchy level. Explicit refs above the current hierarchy level are
+% overriden by label (besides ref), too. Since an explicit ref has
+% preference, it's delayed.
-\enitkv@key{enumitem}{ref}{%
+\enitkv@key{}{ref}{%
\g@addto@macro\enit@delayedkeys{,ref=#1}}
-\enitkv@key{enumitem-delayed}{ref}{%
+\enitkv@key{-delayed}{ref}{%
\def\enit@ref{\enit@reflabel{#1}\@ne}}
% #2=0 don't "normalize" (ie, already normalized)
@@ -552,11 +556,11 @@
% \enit@elt{widest}\count\@count\enit@sc@@count
% \enit@elt is either \enit@getwidth or \enit@refstar, defined
% below
-% The current implementation is sub-optimal -- labels are stored in
+% The current implementation is sub-optimal -- labels are stored in
% labellist, counters defined again when processing labels, and
% modifying it is almost impossible.
-\let\enit@labellist\@empty
+\let\enit@labellist\@empty
\newcommand\AddEnumerateCounter{%
\@ifstar\enit@addcounter@s\enit@addcounter}
@@ -574,8 +578,6 @@
\def\enit@addcounter@s#1#2#3{%
\enit@addcounter{#1}{#2}%
{\@nameuse{enit@sc@\expandafter\@gobble\string#2}{#3}}}
-
-% TODO - \SetEnumerateCounter
% The 5 basic counters:
@@ -591,19 +593,19 @@
% Labels
% ------
-\enitkv@key{enumitem}{itemjoin}{%
+\enitkv@key{}{itemjoin}{%
\def\enit@itemjoin{#1}}
-\enitkv@key{enumitem}{itemjoin*}{%
+\enitkv@key{}{itemjoin*}{%
\def\enit@itemjoin@s{#1}}
-\enitkv@key{enumitem}{afterlabel}{%
+\enitkv@key{}{afterlabel}{%
\def\enit@afterlabel{#1}}
% Mode
% ----
-\enitkv@key{enumitem}{mode}{%
+\enitkv@key{}{mode}{%
\enit@ifunset{enit@mode#1}%
{\enit@checkerror{mode}{#1}}%
{\csname enit@mode#1\endcsname}}
@@ -690,47 +692,47 @@
% Pre and post code
% =================
-\enitkv@key{enumitem}{before}{%
+\enitkv@key{}{before}{%
\def\enit@before{#1}}
-\enitkv@key{enumitem}{before*}{%
+\enitkv@key{}{before*}{%
\expandafter\def\expandafter\enit@before\expandafter
{\enit@before#1}}
-\enitkv@key{enumitem}{after}{%
+\enitkv@key{}{after}{%
\def\enit@after{#1}}
-\enitkv@key{enumitem}{after*}{%
+\enitkv@key{}{after*}{%
\expandafter\def\expandafter\enit@after\expandafter
{\enit@after#1}}
-\enitkv@key{enumitem}{first}{%
+\enitkv@key{}{first}{%
\def\enit@keyfirst{#1}}
-\enitkv@key{enumitem}{first*}{%
+\enitkv@key{}{first*}{%
\expandafter\def\expandafter\enit@keyfirst\expandafter
{\enit@keyfirst#1}}
% Miscelaneous keys
% ================
-\enitkv@key{enumitem}{nolistsep}[true]{%
+\enitkv@key{}{nolistsep}[true]{%
\partopsep=\z@skip
\topsep=\z@ plus .1pt
\itemsep=\z@skip
\parsep=\z@skip}
-\enitkv@key{enumitem}{nosep}[true]{%
+\enitkv@key{}{nosep}[true]{%
\partopsep=\z@skip
\topsep=\z@skip
\itemsep=\z@skip
\parsep=\z@skip}
-\enitkv@key{enumitem}{noitemsep}[true]{%
+\enitkv@key{}{noitemsep}[true]{%
\itemsep=\z@skip
\parsep=\z@skip}
-\enitkv@key{enumitem}{wide}[\parindent]{%
+\enitkv@key{}{wide}[\parindent]{%
\enit@align@left
\leftmargin\z@
\labelwidth\z@
@@ -740,7 +742,7 @@
% The following is deprecated in favour of wide:
-\enitkv@key{enumitem}{fullwidth}[true]{%
+\enitkv@key{}{fullwidth}[true]{%
\leftmargin\z@
\labelwidth\z@
\def\enit@align##1{\hskip\labelsep##1}}
@@ -754,7 +756,7 @@
\newcommand\SetEnumitemValue[2]{% Implicit #3
\enit@ifunset{enit@enitkv@#1}%
{\enit@ifunset{enitkv@enumitem@#1}%
- {\enit@error{Wrong key `#1' in \string\SetEnumitemValue}%
+ {\enit@error{Wrong key '#1' in \string\SetEnumitemValue}%
{Perhaps you have misspelled it}}{}%
\expandafter\let\csname enit@enitkv@#1\expandafter\endcsname
\csname enitkv@enumitem@#1\endcsname}{}%
@@ -772,8 +774,8 @@
\newcommand\SetEnumitemKey[2]{%
\enit@ifunset{enitkv@enumitem@#1}%
- {\enitkv@key{enumitem}{#1}[]{\enitkv@setkeys{enumitem}{#2}}}%
- {\enit@error{Duplicated key `#1' in \string\SetEnumitemKey}%
+ {\enitkv@key{}{#1}[]{\enitkv@setkeys{enumitem}{#2}}}%
+ {\enit@error{Duplicated key '#1' in \string\SetEnumitemKey}%
{There already exists a key with that name}}}
% +=============================+
@@ -782,6 +784,8 @@
%
% Set keys
% ========
+%
+% Default definition. Modified below with package option 'sizes'.
\def\enit@setkeys#1{%
\enit@ifunset{enit@@#1}{}%
@@ -792,7 +796,7 @@
\def\enit@setkeys@i#1\@@{%
\let\enit@delayedkeys\@empty
- \enit@shl{#1}% is or returns \enit@toks
+ \enit@shl{#1}% is either \enit@toks or returns it
\expandafter\enit@setkeys@ii\the\enit@toks\@@}
\def\enit@setkeys@ii#1\@@{%
@@ -815,14 +819,14 @@
{\csname enit@widest\expandafter\@gobbletwo\string##1\endcsname{#4}}}}
\def\enit@valueerror#1{\z@ % if after an assignment, but doesn't catch \ifnum
- \enit@error{No default \string\value\space for `#1'}%
+ \enit@error{No default \string\value\space for '#1'}%
{You can provide one with widest*}}%
\let\enit@values\@empty
\def\enit@calcwidth{%
\ifenit@calcwidest
- \ifcase\enit@type% ie, enum
+ \ifcase\enit@type % ie, enum
\enit@ifunset{enit@cw@\@enumctr}%
{\@namedef{enit@cv@\@enumctr}{\enit@valueerror\@enumctr}}%
{\edef\enit@values{%
@@ -840,13 +844,13 @@
\xdef\enit@a{\labelwidth\the\labelwidth\relax}%
\endgroup
\enit@a
- \or
+ \or % ie, item
\ifx\enit@widest@\relax
\settowidth\labelwidth{\@itemlabel}%
\else
\settowidth\labelwidth{\enit@widest@}%
\fi
- \else
+ \else % ie, desc
\ifx\enit@widest@\relax
\settowidth\labelwidth{\@itemlabel}%
\else
@@ -902,9 +906,9 @@
\def\value{\enit@refstar@i\value}%
\let\enit@elt\enit@refstar
\enit@labellist
- \protected@xdef\enit@a{{#2}}% Added braces as \ref is in the
+ \protected@xdef\enit@a{{#2}}% Added braces as \ref is in the
\endgroup
- \expandafter\let#1\enit@a} % global scope.
+ \expandafter\let#1\enit@a} % global scope.
% Preliminary settings and default values
% =======================================
@@ -915,7 +919,14 @@
\edef\enit@prevlabel{#3\romannumeral#2}%
\advance#2\@ne}
+\newcount\enit@count@id
+
+\def\enit@tagid{%
+ \global\advance\enit@count@id\@ne
+ \edef\EnumitemId{\number\enit@count@id}}
+
\def\enit@preset#1#2#3{%
+ \enit@tagid
\enit@sepfrommarginfalse
\enit@calcwidestfalse
\let\enit@widest@\relax
@@ -971,7 +982,7 @@
\noexpand\enitkv@setkeys{enumitem-resume}{\the\enit@toks}}%
\enit@b
\let\enitkv@errx\enitkv@err@b
- \ifcase\enit@resuming\or\or % = 2
+ \ifcase\enit@resuming\or\or % = 2, resume* series
\expandafter
\enit@setkeys@i\enit@resumekeys,resume=\enit@series\@@
\or % = 3
@@ -985,7 +996,7 @@
% ================================
% The following code is based on LaTeX (\DeclareFontShape). Only the
% code for <> is preserved (no functions), and a default value can be
-% set before the first <>. In addition, here single values take
+% set before the first <>. In addition, here single values take
% precedende over ranges. The original work is by the LaTeX Team,
% under license LPPL.
@@ -1051,30 +1062,28 @@
\def\enit@a{#1}%
\let\enit@c\relax % last in range
\let\enit@d\relax % single
- \expandafter\enit@extractrange\enit@a <-*>\@nil<\@nnil}
+ \expandafter\enit@extractrange\enit@a <-*>\@nil<\@nnil
+ \ifx\enit@d\relax\else\let\enit@c\enit@d\fi}
% \enit@setlength is defined in the options section
% This ends the code adapted from latex (under LPPL).
-% TODO - \SetEnumitemSizes
-% TODO - \setlist<size>[opt]{..}
-
-\def\enit@getsizefor#1#2{%
+\def\SetEnumitemSize#1#2{%
{\let\selectfont\relax
#2%
- \expandafter\xdef\csname enit@sizefor@#1\endcsname{\f@size}}}
-
-\enit@getsizefor{script}\scriptsize
-\enit@getsizefor{tiny}\tiny
-\enit@getsizefor{footnote}\footnotesize
-\enit@getsizefor{small}\small
-\enit@getsizefor{normal}\normalsize
-\enit@getsizefor{large}\large
-\enit@getsizefor{Large}\Large
-\enit@getsizefor{LARGE}\LARGE
-\enit@getsizefor{huge}\huge
-\enit@getsizefor{Huge}\Huge
+ \expandafter\xdef\csname enit@sizefor@#1\endcsname{\f@size}}}
+
+\SetEnumitemSize{script}\scriptsize
+\SetEnumitemSize{tiny}\tiny
+\SetEnumitemSize{footnote}\footnotesize
+\SetEnumitemSize{small}\small
+\SetEnumitemSize{normal}\normalsize
+\SetEnumitemSize{large}\large
+\SetEnumitemSize{Large}\Large
+\SetEnumitemSize{LARGE}\LARGE
+\SetEnumitemSize{huge}\huge
+\SetEnumitemSize{Huge}\Huge
% +=============================+
% | LIST TYPES |
@@ -1318,7 +1327,7 @@
\setbox\enit@inbox\hbox\bgroup\color@begingroup
\let\item\enit@endinbox
\hskip1sp % in case the first thing is \label
- \ignorespaces}
+ \ignorespaces}
% Pause item
% ----------
@@ -1394,7 +1403,7 @@
\csname\@itemitem\endcsname
{\let\enit@calc\z@
\def\makelabel##1{\enit@align{\enit@format{##1}}}%
- \enit@preset{#2}{#1}{#4}%
+ \enit@preset{#2}{#1}{#4}%
\enit@calcleft
\enit@before}%
\enit@keyfirst
@@ -1458,11 +1467,10 @@
\parsep\parskip
\csname @list\romannumeral\the\@listdepth\endcsname
\@nmbrlistfalse
+ \enit@tagid
\enit@setglobalkeys % ie, list and list<num>
\enit@setkeys{trivlist}%
\enit@setkeys{trivlist\romannumeral\@listdepth}%
- \enit@setkeys{\@currenvir}%
- \enit@setkeys{\@currenvir\romannumeral\@listdepth}%
\@trivlist
\labelwidth\z@
\leftmargin\z@
@@ -1470,17 +1478,6 @@
\let\@itemlabel\@empty
\def\makelabel##1{##1}}
-% Let's recognize also the standard trivlists (except theorems)
-
-\let\enitdp@quote\@empty
-\let\enitdp@quotation\@empty
-\let\enitdp@verse\@empty
-\let\enitdp@thebibliography\@empty
-\let\enitdp@center\@empty
-\let\enitdp@flushleft\@empty
-\let\enitdp@flushright\@empty
-\let\enitdp@tabbing\@empty
-
% Description styles
% ==================
%
@@ -1527,7 +1524,7 @@
\fi}%
\unhbox\@labels
\skip@\lastskip % Save last \labelsep
- \unskip % Remove it
+ \unskip % Remove it
\enit@lblpenalty % Restore it, after penalty
\fi
\if@nobreak
@@ -1565,23 +1562,47 @@
% Remember \romannumeral0 expands to nothing.
% #1 = list name, #2 = level, #3 = flag if star, #4 = keys/values
+\let\enit@keys@sizes\relax
+
\def\enit@saveset#1#2#3#4{%
\setcounter{enit@cnt}{#2}%
- \ifcase#3%
- \expandafter
- \def\csname enit@@#1\romannumeral\c@enit@cnt\endcsname{#4}%
- \or
- \expandafter\let\expandafter\enit@b
- \csname enit@@#1\romannumeral\c@enit@cnt\endcsname
- \ifx\enit@b\relax
- \let\enit@b\@empty
+ \ifx\enit@forsize\@empty
+ \ifcase#3%
+ \expandafter
+ \def\csname enit@@#1\romannumeral\c@enit@cnt\endcsname{#4}%
+ \or
+ \expandafter\let\expandafter\enit@b
+ \csname enit@@#1\romannumeral\c@enit@cnt\endcsname
+ \ifx\enit@b\relax
+ \let\enit@b\@empty
+ \fi
+ \expandafter\def
+ \csname enit@@#1\romannumeral\c@enit@cnt\expandafter\endcsname
+ \expandafter{\enit@b,#4}%
+ \fi
+ \else
+ \ifcase#3%
+ \enit@ifunset{enit@@#1\romannumeral\c@enit@cnt}%
+ {\expandafter\let
+ \csname enit@@#1\romannumeral\c@enit@cnt\endcsname\@empty}%
+ {}%
+ \expandafter\let\expandafter\enit@b
+ \csname enit@@#1\romannumeral\c@enit@cnt @@sizes\endcsname
+ \ifx\enit@b\relax
+ \let\enit@b\@empty
+ \fi
+ \toks@\expandafter{\enit@b}%
+ \edef\enit@b{\the\toks@\enit@forsize\enit@keys@sizes}%
+ \expandafter\def
+ \csname enit@@#1\romannumeral\c@enit@cnt @@sizes\expandafter\endcsname
+ \expandafter{\enit@b{#4}}%
+ \else
+ \enit@error{* and \string<\string> are not compatible}%
+ {Use either * or angles, but not both.}%
\fi
- \expandafter\def
- \csname enit@@#1\romannumeral\c@enit@cnt\expandafter\endcsname
- \expandafter{\enit@b,#4}%
\fi}
-% To do: more robust tests (catch wrong names, but not easy)
+% TODO: more robust tests (catch wrong key names, but not easy)
% Internally, LaTeX uses a short name for enumerate (enum)
% and itemize (item). To be consistent with this convention,
@@ -1595,6 +1616,19 @@
\@ifstar{\enit@setlist\@ne}{\enit@setlist\z@}}
\def\enit@setlist#1{%
+ \@ifnextchar<%
+ {\enit@setlist@q#1}%
+ {\let\enit@forsize\@empty\enit@setlist@n#1}}
+
+% Default definitions. Modified below with option 'sizes':
+
+\def\enit@setlist@q#1<#2>{%
+ \enit@error
+ {Activate this feature with options 'sizes'}%
+ {Size dependent setting with \string<\string> must be\MessageBreak
+ explicitly activated with the package option 'sizes'}}
+
+\def\enit@setlist@n#1{%
\@ifnextchar[{\enit@setlist@x#1}{\enit@setlist@i#1\@empty}}
% Let's accept \setlist[]*{}, too, because an error in <=3.5.1
@@ -1670,7 +1704,7 @@
\def\enit@newlist#1#2#3#4{%
\enit@ifunset{enit@xset@#3}%
- {\enit@error{Unknown list type `#3')}%
+ {\enit@error{Unknown list type '#3')}%
{Valid types are:
enumerate, itemize, description,\MessageBreak
enumerate*, itemize*, description*}}%
@@ -1717,7 +1751,9 @@
\enit@setkeys{list}%
\enit@setkeys{list\romannumeral\@listdepth}}}
\let\enit@setglobalkeys\relax
+
\DeclareOption{loadonly}{\enit@loadonlytrue}
+
\DeclareOption{shortlabels}
{\def\enit@shl#1{%
\ifnum\enit@type=\tw@
@@ -1726,6 +1762,7 @@
\def\enit@c{#1}%
\enit@first#1,\@nil\@@nil % Returns enit@toks
\fi}}
+
\DeclareOption{inline}
{\newenvironment{enumerate*}[1][]%
{\@nameuse{enit@enumerate*}\enitdp@enumerate{enum}\thr@@{#1}}
@@ -1738,11 +1775,29 @@
{\@nameuse{enit@enddescription*}}}
\let\enit@setlength\setlength
-\DeclareOption{sizes}
+\DeclareOption{sizes}
{\def\enit@setlength#1#2{%
- \enit@try@size@range{#2}% Returns \enit@c and or enit@d
- \ifx\enit@d\relax\else\let\enit@c\enit@d\fi
- \setlength#1{\enit@c}}}
+ \enit@try@size@range{#2}% Returns \enit@c
+ \setlength#1{\enit@c}}%
+ \def\enit@setkeys#1{%
+ \enit@ifunset{enit@@#1}{}%
+ {\let\enit@c\@empty
+ \enit@ifunset{enit@@#1@@sizes}{}%
+ {\expandafter\let\expandafter\enit@a\csname enit@@#1@@sizes\endcsname
+ \expandafter\enit@try@size@range\expandafter{\enit@a}%
+ \def\enit@keys@sizes{\def\enit@c}%
+ \enit@c
+ \let\enit@keys@sizes\relax}%
+ \expandafter\expandafter\expandafter
+ \enit@setkeys@i
+ \csname enit@@#1\expandafter\endcsname
+ \expandafter,\enit@c\@@}}%
+ \def\enit@setlist@q#1<#2>{%
+ \def\enit@forsize{<#2>}%
+ \enit@setlist@n#1}}
+
+\chardef\enit@seriesopt\z@
+\DeclareOption{series=override}{\chardef\enit@seriesopt\tw@}
\let\enit@shl\enit@toks
@@ -1785,28 +1840,34 @@
\hskip-\leftmargin
\hskip\labelindent
\vrule width -\labelindent height 6pt depth -5pt
- \hskip\labelindent
+ \hskip\labelindent
\else
\hskip-\labelsep
\hskip-\labelwidth
\hskip-\labelindent
- \vrule width \labelindent height 6pt depth -4pt
+ \vrule width \labelindent height 6pt depth -4pt
\fi
\vrule width \labelwidth height 4pt depth -2pt
\vrule width \labelsep height 2pt}%
\else
- \enit@error
- {\string\DrawEnumitemLabel\space must be used in vertical mode}%
- {Very likely, just inserting a blank line before will fix it}}
-
+ \enit@error
+ {\string\DrawEnumitemLabel\space must be used in vertical mode}%
+ {Very likely, just inserting a blank line before will fix it}%
+ \fi}
+
% TODO - option 'verbose'
% +=============================+
% | TWO-PASS TOOLS |
% +=============================+
-% TODO - downstep
-% TODO - autowidest
+% TODO - Not for the moment, because both tools would require to take
+% into account series and resume, which is not simple. Also, are they
+% applied to all lists, by type, by level, by name, etc.? Document how
+% to do it in at least the simplest cases.
+%
+% - reverse counting
+% - automatic widest, based on existing labels.
\endinput