diff options
author | Karl Berry <karl@freefriends.org> | 2019-01-14 22:05:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-01-14 22:05:41 +0000 |
commit | 476c59429d32e613e223cab375c292ffddcdaa8d (patch) | |
tree | 7f1aeb9291e6b89e0f67751160a70392402f4931 /Master/texmf-dist | |
parent | f7f1f807d00177577e28ff9d0992e86659b5997f (diff) |
enumitem (14jan19)
git-svn-id: svn://tug.org/texlive/trunk@49702 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/enumitem/README.md | 10 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/enumitem/enumitem.pdf | bin | 135285 -> 141292 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/enumitem/enumitem.tex | 473 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/enumitem/enumitem.sty | 395 |
4 files changed, 557 insertions, 321 deletions
diff --git a/Master/texmf-dist/doc/latex/enumitem/README.md b/Master/texmf-dist/doc/latex/enumitem/README.md index b436e03cef9..29d6c1eca3f 100644 --- a/Master/texmf-dist/doc/latex/enumitem/README.md +++ b/Master/texmf-dist/doc/latex/enumitem/README.md @@ -1,4 +1,4 @@ -## Enumitem 3.6 +## Enumitem 3.7 This package provides most of the flexibility you may want to customize the three basic list environments (`enumerate`, `itemize` and @@ -8,6 +8,12 @@ syntax. ### Latest changes ``` +3.7 2019-01-14 + - Option series=override, to overcome some backwards + incompatibilities. + - Extension to \setlist for sizes (\setlist<size>) + - \SetEnumitemSize, for size dependent settings. + - \EnumitemId, with a unique numeric identifier for eash list. 3.6 2018-11-30 - New key 'left', for fast, tab-like positioning of the label. - The key 'widest' now works with 'itemize' and 'description'. @@ -27,4 +33,4 @@ Repository: https://github.com/jbezos/enumitem ________ Javier Bezos --- http://www.texnia.com -2018/11/30 +2019/01/14 diff --git a/Master/texmf-dist/doc/latex/enumitem/enumitem.pdf b/Master/texmf-dist/doc/latex/enumitem/enumitem.pdf Binary files differindex c841946c9ea..0da16b234aa 100644 --- a/Master/texmf-dist/doc/latex/enumitem/enumitem.pdf +++ b/Master/texmf-dist/doc/latex/enumitem/enumitem.pdf diff --git a/Master/texmf-dist/doc/latex/enumitem/enumitem.tex b/Master/texmf-dist/doc/latex/enumitem/enumitem.tex index 6fad4dcebfb..889606770fd 100644 --- a/Master/texmf-dist/doc/latex/enumitem/enumitem.tex +++ b/Master/texmf-dist/doc/latex/enumitem/enumitem.tex @@ -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. @@ -56,7 +56,7 @@ suggestions go to \href{http://www.texnia.com/enumitem.html}% {\texttt{http://www.texnia.com/enumitem.html}}.}} -\date{Version 3.6\\2018/11/30} +\date{Version 3.7\\2019/01/14} \IfFileExists{enumitem.sty}{\usepackage{enumitem}}{} @@ -74,6 +74,25 @@ suggestions go to \href{http://www.texnia.com/enumitem.html}% \maketitle \tableofcontents +\newpage + +\vspace*{1cm} + +\begin{note} + Changes and new features with relation to version 3.5 are highlighted + with \New{X.X}\hspace{-.5em}. The most recent features could be still + unstable. Please, report any issues you find on + \texttt{https://github.com/jbezos/enumitem/issues}, which is better + than just complaining on an e-mail list or a web forum. Feel free to + fork it and make pull requests. +\end{note} + +\begin{warning} + Version 3.6 introduced two new keys: |left| and |first|. If your + documents define some series with these names, an error is raised. + Just rename them, or set the package option |series=override|. +\end{warning} + \section{Introduction} This package provides most of the flexibility you may want to customize @@ -81,7 +100,7 @@ the three basic list environments (|enumerate|, |itemize| and |description|) and to design your own lists, with a |<key>=<value>| syntax: \begin{itemize} -\item Fancy labels and fancy refs, including a syntax similar to that +\item Fancy labels and fancy refs, including a syntax similar to that in the \textsf{enumerate} package. \item Alternative ways for positioning the label, with a new @@ -102,15 +121,15 @@ resuming. \end{itemize} In the interface a sort of ``inheritance'' is used. You can set -globally the behaviour of lists and then override several parameters -of, say, |enumerate| and then in turn override a few paremeters of a +globally the behavior of lists and then override several parameters of, +say, |enumerate| and then in turn override a few parameters in a particular instance. The values will be searched in the hierarchy. The package extends the syntax of the lists to allow an optional argument where a set of parameters in the form |key=value| are -available. These keys are equivalent to the well known list parameters --- please, see a \LaTeX{} manual for a description of them. Next -sections explains the extensions provided by |enumitem|. +available. These keys are equivalent to the well known list parameters. +Please, see a \LaTeX{} manual for a description of them. Next sections +explains the extensions provided by |enumitem|. \begin{itemize} \item Vertical spacing: @@ -135,9 +154,9 @@ Horizontal spacing: \end{itemize} \begin{example} - A straighforward example is: + A straightforward example is: \begin{verbatim} -\begin{itemize}[itemsep=1ex,leftmargin=1cm] +\begin{itemize}[itemsep=1ex, leftmargin=1cm] \end{verbatim} \end{example} @@ -186,6 +205,12 @@ label: |inline| and then the environments |enumerate*|, |itemize*| and |description*|. +\item To set a numeric label with parenthesis, but a cross-reference +without them: +\begin{verbatim} +\begin{enumerate}[label=(\arabic*), ref=\arabic*] +\end{verbatim} + \end{itemize} \section{Keys} @@ -194,6 +219,12 @@ This section describes the keys in displayed lists. Most of them are available in inline lists, where further keys are available (see \ref{s.inline}). +\begin{warning} + If the value is completely enclosed in braces, they are removed. If + you want the braces, they must be duplicated. This is the default + behavior of \textsf{keyval}, which \textsf{enumitem} just emulates. +\end{warning} + \subsection{Label and cross references format} \begin{desc} @@ -209,7 +240,7 @@ corresponding syntax.} It works with |\value|, too (provided the widest label is not to be computed or |widest*| is used, see below). \begin{note} - If you prefer setting labels like the \textsf{enumerate} package, use + If you prefer setting labels like the \textsf{enumerate} package, use ``short labels'' (see section \ref{s.short}). \end{note} @@ -261,9 +292,9 @@ on): By default, |label| sets also the form of cross references and |\the...| (overriding the settings in parent hierarchical levels), but you can define a different format with this key. For -example, to remove the right parethesis: +example, to remove the right parenthesis: \begin{verbatim} -\begin{enumerate}[label=\emph{\alph*}),ref=\emph{\alph*}] +\begin{enumerate}[label=\emph{\alph*}), ref=\emph{\alph*}] \end{verbatim} \begin{note} @@ -282,7 +313,7 @@ example, to remove the right parethesis: The |label|s are \textit{not} accumulated to form the reference. If you want, say, something like 1.\textit{a} from 1) as first level and \textit{a}) as second level, you must set it with |ref|. You may - use |\ref{level1}.\ref{level2}| with appropiate |ref| settings, but as + use |\ref{level1}.\ref{level2}| with appropriate |ref| settings, but as Robin Fairbairns points out in the \TeX{} FAQ: \begin{quote} \dots{} [that] would be both tedious and error-prone. What is more, it @@ -306,11 +337,13 @@ example, to remove the right parethesis: |font=<commands>|\qquad|format=<commands>| \end{desc} -Sets the label font. Useful when the label is changed with the -optional argument of |\item| and in \texttt{description}. The last -command in |<commands>| can take an argument with the item label. In +Sets the label font. Useful when the label is changed with the optional +argument of |\item| and in \texttt{description}. The last command in +|<commands>| can take an argument with the item label. In \texttt{description} class setting are in force, so you may want begin -with |\normalfont|. A synonymous is \texttt{format}. +with |\normalfont|. A synonymous is \texttt{format}. Actually, this key +may be used for any stuff to be executed at each |\item|, just before the +label. \begin{desc} |align=left|\qquad |align=right|\qquad |align=parleft| @@ -342,9 +375,9 @@ to: \end{verbatim} \begin{example} - Although primarily intended for the alignment, this commands has other - uses (an example is the provided |parleft|). For example, with the - following all labels with |align=right| are set as superscripts: + Although primarily intended for the alignment, this commands has + other uses (an example is the provided |parleft|). For example, with + the following all labels with |align=right| are set as superscripts: \begin{verbatim} \SetLabelAlign{right}{\hss\llap{\textsuperscript{#1}}} \end{verbatim} @@ -352,9 +385,9 @@ to: \end{example} \begin{note} - If the last thing in the definition is a skip (typically |\hfil|), it is - removed sometimes by |description|. If for some reason you want to avoid - this, just add |\null| at the end. + If the last thing in the definition is a skip (typically |\hfil|), it + is removed sometimes by |description|. If for some reason you want to + avoid this, just add |\null| at the end. \end{note} \begin{note} @@ -377,7 +410,7 @@ a future release.} \begin{tabular}{cc} \fbox{\fbox{\strut \texttt{labelindent}} \fbox{\strut \texttt{labelwidth}} - \fbox{\strut \texttt{labelsep} $-$ \texttt{itemintent}}} + \fbox{\strut \texttt{labelsep} $-$ \texttt{itemindent}}} & \fbox{\strut\texttt{itemindent}}\\ \texttt{leftmargin} @@ -391,11 +424,10 @@ Actually, the layout is more complex because the label box (ie, takes a negative value. \begin{note} - Since |\parindent| is not used as such inside lists, but instead - is set internally to either |\itemindent| or |\listparindent|, - when used as the value of a parameter \textsf{enumitem} returns - the global value, i. e., the value it has outside the outermost - list. + Since |\parindent| is not used as such inside lists, but instead is + set internally to either |\itemindent| or |\listparindent|, when used + as the value of a parameter \textsf{enumitem} returns the global + value, i. e., the value it has outside the outermost list. \end{note} \begin{note} @@ -424,7 +456,7 @@ ignored. There is a new counter length |\labelindent|. -The five parameteres are related in the following way: +The five parameters are related in the following way: \[ |\leftmargin|+|\itemindent| = |\labelindent|+|\labelwidth|+|\labelsep| @@ -469,9 +501,10 @@ left margin (the ``start of text'') is computed with the |labelsep|. Sets which value is to be computed from the others. The default is |labelindent=!|, but note some keys set another value (|wide| and -description |style|s). Computations are done after \textit{all} -keys has been read. Explicit values are not lost, and so with the -following hierarchical settings: \begin{verbatim} +description |style|s). Computations are done after \textit{all} keys +has been read. Explicit values are not lost, and so with the following +hierarchical settings: +\begin{verbatim} leftmargin=2em labelindent=1em,leftmargin=! labelindent=! @@ -496,10 +529,13 @@ Examples are: \begin{verbatim} \begin{itemize}[label=\textbullet, leftmargin=*] \begin{enumerate}[label=\roman*), leftmargin=*, widest=iii] -\begin{itemize}[label=\textbullet, - leftmargin=2pc, labelsep=*] -\begin{enumerate}[label=\arabic*., leftmargin=2\parindent, - labelindent=\parindent, labelsep=*] +\begin{itemize}[label = \textbullet, + leftmargin = 2pc, + labelsep = *] +\begin{enumerate}[label = \arabic*., + labelindent = \parindent, + leftmargin = 2\parindent, + labelsep = *] \end{verbatim} The most useful are |labelsep=*| and |leftmargin=*|. With the former @@ -531,7 +567,7 @@ overrides the default value for the widest printed counter. Sometimes, if lists are not very long, a value of |a| for |\alph| is more sensible than the default |m|: \begin{verbatim} -\begin{enumerate}[leftmargin=*,widest=a] % Assume standard 2nd level +\begin{enumerate}[leftmargin=*, widest=a] % Assume standard 2nd level \end{verbatim} With no value, the default is restored. With |widest*|, the string is built using |<integer>| as the value of the counter (e.g., with @@ -579,14 +615,14 @@ the current list and not from that in the enclosing list/text. while the item body is indented depending on the label and a fixed |labelsep|: \begin{verbatim} -labelindent=\parindent, -leftmargin=* +labelindent = \parindent, +leftmargin = * \end{verbatim} A fairly frequent variant is aligning the label with the surrounding text (remember |labelindent| is |0pt| by default if it is not the computed parameter): \begin{verbatim} -leftmargin=* +leftmargin = * \end{verbatim} The former looks better in the first level while the latter seems preferable in subsequent ones. That can be easily set with @@ -601,7 +637,7 @@ leftmargin=* |\parindent|. In this case (remember |labelindent| is the computed parameter if not set): \begin{verbatim} -leftmargin=\parindent +leftmargin = \parindent \end{verbatim} \end{example} @@ -609,15 +645,15 @@ leftmargin=\parindent A third pattern would be the label aligned with |\parindent|, and the item body with |2\parindent|: \begin{verbatim} -labelindent=\parindent, -leftmargin=2\parindent, -itemsep=* +labelindent = \parindent, +leftmargin = 2\parindent, +itemsep = * \end{verbatim} Again, a variant would be the label aligned with the surrounding - text, and the itembody with |\parindent|: + text, and the item body with |\parindent|: \begin{verbatim} -leftmargin=\parindent, -itemsep=* +leftmargin = \parindent, +itemsep = * \end{verbatim} \end{example} @@ -645,29 +681,30 @@ Text. \end{enumerate} \end{verbatim} -This is done locally. If you want global resuming, see next section on series. +This is done locally. If you want global resuming, see next section on +series. \begin{desc} |resume*| \end{desc} -Like |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). It should -be used sparingly---if you are using it often, then very likely you -want to define a new list (see \ref{s.clone}). Further keys are allowed, and -in this case the saved options are overriden by those in the current -list (i.e., the position of \texttt{resume*} does not matters). -If there is a series of a certain list with -\texttt{resume*}, options are taken from the list previous to the -first one, except for \texttt{start}. +Like |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). It should be +used sparingly---if you are using it often, then very likely you want +to define a new list (see \ref{s.clone}). Further keys are allowed, and +in this case the saved options are overridden by those in the current +list (i.e., the position of \texttt{resume*} does not matters). If +there is a series of a certain list with \texttt{resume*}, options are +taken from the list previous to the first one, except for +\texttt{start}. \begin{example} For example: \begin{verbatim} -\begin{enumerate}[resume*,start=1] % or [start=1,resume*] +\begin{enumerate}[resume*, start=1] % or [start=1, resume*] \end{verbatim} - uses the keys in the previuos \texttt{enumerate}, but restarts the + uses the keys in the previous \texttt{enumerate}, but restarts the counter. \end{example} @@ -697,15 +734,15 @@ alternative to |resume*=<series>|. \begin{example} Consider: \begin{verbatim} -\begin{enumerate}[label=\arabic*(a),leftmargin=1cm,series=lafter] +\begin{enumerate}[label=\arabic*(a), leftmargin=1cm, series=l_after] \item A \item B \end{enumerate} \end{verbatim} You get: 1(a) 2(a). You can continue with: \begin{verbatim} -\begin{enumerate}[label=\arabic*(b),resume*=lafter] - % or [label=\arabic*(b),lafter] +\begin{enumerate}[label=\arabic*(b), resume*=l_after] + % or [label=\arabic*(b), l_after] \item A \item B \end{enumerate} @@ -715,8 +752,8 @@ alternative to |resume*=<series>|. Note you can add further arguments, which are executed after those saved at the starting list and therefore take precedence over them -- -in particular, |resume*| itself takes precedence over a -|start| (e.g., |start=1|) in the the starting list. +in particular, |resume*| itself takes precedence over a |start| (e.g., +|start=1|) in the the starting list. \begin{note} Every time a series is started, several commands are defined @@ -724,6 +761,21 @@ in particular, |resume*| itself takes precedence over a non-overlapping series. \end{note} +\begin{warning} + The package may introduce new keys in the future, so using directly + |<series>| as a key is a potential source of forward + incompatibilities. However, it's safe using a non-letter character + other than hyphen or star in the key name (e.g., |!notes| or + |m_steps|), as well as uppercase letters and digits, because + \textsf{enumitem} will never use them. \New{3.7} If you have defined + some series with an all lowercase name and a new conflicting key has + been introduced, an alternative to changing their names is the + package option |series=override| (the error message is + \texttt{Invalid series name `key'}). With it series names take + precedence over predefined keys -- but use it only when absolutely + necessary. +\end{warning} + \subsection{Penalties} \begin{desc} @@ -736,6 +788,9 @@ end of the list, respectively. Please, refer to your \LaTeX{} or \TeX{} manual about 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 child lists. + +\subsection{Injecting code} + \begin{desc} |before=<code>| \qquad |before*=<code>| \end{desc} @@ -752,7 +807,7 @@ and you can access and manipulate the list parameters. \begin{example} To have both margins (left and right) set to the widest label: \begin{verbatim} -\setlist{leftmargin=*,before=\setlength{\rightmargin}{\leftmargin}} +\setlist{leftmargin=*, before=\setlength{\rightmargin}{\leftmargin}} \end{verbatim} \end{example} @@ -766,7 +821,7 @@ Same, but just before the list ends. |first=<code>|\qquad|first*=<code>| \end{desc} -Same, but as the very first thing in the list body, so that +\New{3.6} Same, but as the very first thing in the list body, so that \begin{verbatim} \begin{itemize}[first=<code>] \end{verbatim} @@ -777,6 +832,61 @@ is the same as \end{verbatim} With it you may insert, for example, an |\item|. +\begin{desc} +|\EnumitemId| +\end{desc} + +To help in some tasks, a unique numeric identifier is assigned to each +list, returned by |\EnumitemId|. + +\begin{example} + Here is an example of how to combine a |\label| with |\EnumitemId|, + and |after| to automatically set the width of the list label to the + widest one (provided the ref is the same as the label):\footnote{See + \texttt{https://tex.stackexchange.com/questions/29322/% + how-to-make-enumerate-items-align-at-left-margin}.} +\begin{verbatim} +\SetEnumitemKey{widestlabel} + {labelwidth = \widthof{\ref{enum-\EnumitemId}}, + after = \label{enum-\EnumitemId}} +\end{verbatim} +Then just use the key |widestlabel|. +\end{example} + +\begin{example} + Reverse counting is also doable, but somewhat trickier, and we need + some ``external'' help. Here is a possible solution, but not the + only one (and very likely not even the best -- for example, |start| + is in fact no-op). + +\begin{verbatim} +\usepackage{calc,cleveref,crossreftools} +\crtrefundefinedtext{0} + +\newcounter{revcount} +\newcommand\revcounter[1]{% + \setcounter{revcount}{1+\crtcrefnumber{enum-\EnumitemId}-\value{#1}}} +\AddEnumerateCounter\revcounter\revcounter{} % the 2nd is dummy + +\SetEnumitemKey{revarabic} + {label = \revcounter*(\arabic{revcount}), + ref = (\arabic{revcount}), + after = \label{enum-\EnumitemId}} +\end{verbatim} + Note |ref| must be set separately, because |\revcounter| + is not expandable. +\end{example} + +\begin{example} + With |first| you can define your own environments for displayed + material. A trivial example is: +\begin{verbatim} +\newlist{letter}{itemize}{1} +\setlist[letter]{first=\item[]\itshape, rightmargin=\leftmargin} +\end{verbatim} +Here there is no need for a |label|, because it is not used. +\end{example} + \subsection{Description styles} A key available in |description|. @@ -812,11 +922,11 @@ necessary. Same as |style=standard,align=parleft,labelwidth=!|. \begin{warning} \begin{enumerate} -\item Mixing boxed and unboxed labels has not a well-defined behaviour. +\item Mixing boxed and unboxed labels has not a well-defined behavior. \item When nesting list all combinations are allowed but not all make sense. \item Nesting |nextline| lists is not supported (it works, but its - behaviour might change in the future, because the current one is not + behavior might change in the future, because the current one is not what one could expect). \end{enumerate} \end{warning} @@ -831,7 +941,7 @@ The key |noitemsep| kills the space between items and paragraphs (i.e., |itemsep=0pt| and |parsep=0pt|), while |nosep| kills all vertical spacing.\footnote{The key \texttt{nolistsep}, now deprecated, introduced a thin stretch, which -was not the intended behaviour.} +was not the intended behavior.} \subsection{``Wide'' lists} @@ -850,7 +960,7 @@ align=left, leftmargin=0pt, labelindent=\parindent, listparindent=\parindent, labelwidth=0pt, itemindent=! \end{verbatim} With |wide=<parindent>| you may set at once another value instead of -|\parindent|. Of course, these keys can be overriden after +|\parindent|. Of course, these keys can be overridden after |wide|, too; for example, remembering that with left-aligned labels the text is pushed if the they are wider than |labelwidth|, you can set |labelwidth=1.5em| for a minimal width, or instead of @@ -880,6 +990,8 @@ example: ... \end{enumerate} \end{verbatim} +You may want to set |ref|, too, if different from the label. + Although perhaps not so useful, you can omit |label=| in the itemize environment under similar conditions, too: \begin{verbatim} @@ -893,7 +1005,7 @@ itemize environment under similar conditions, too: \end{desc} With this command, you can define new keys (or redefine them), which is -particularly useful for enumerate to be adapted to especific +particularly useful for enumerate to be adapted to specific typographical rules or to extend it for non-Latin scrips. Here |<replacement>| contains one of the starred versions of counters. @@ -923,7 +1035,7 @@ defined can then be used like the others. \begin{example} With \begin{verbatim} -\SetEnumitemKey{midsep}{topsep=3pt,partopsep=0pt} +\SetEnumitemKey{midsep}{topsep=3pt, partopsep=0pt} \end{verbatim} you may write \begin{verbatim} @@ -935,22 +1047,22 @@ defined can then be used like the others. Another example is multicolumn lists, with \textsf{multicol}: \begin{verbatim} \SetEnumitemKey{twocol}{ - itemsep=1\itemsep, - parsep=1\parsep, - before=\raggedcolumns\begin{multicols}{2}, - after=\end{multicols}} + itemsep = 1\itemsep, + parsep = 1\parsep, + before = \raggedcolumns\begin{multicols}{2}, + after = \end{multicols}} \end{verbatim} Here, the settings for \texttt{itemsep} and \texttt{parsep} kill the - stretch and shrink parts. Of course, you may want to define a - new list. + stretch and shrink parts, which in this case improves the result. Of + course, you may want to define a new list. \end{example} \begin{warning} The package may introduce new keys in the future, so - |\SetEnumitemKey| is a potential source of forward - incompatibilities. However, it's safe using a non-letter character - other than hyphen or star in the key name (e.g., |:name| or - |2_col|), because \textsf{enumitem} will not use them. + |\SetEnumitemKey| is a potential source of forward incompatibilities. + However, it's safe using a non-letter character other than hyphen or + star in the key name (e.g., |:name| or |2_col|), as well as uppercase + letters and digits, because \textsf{enumitem} will never use them. \end{warning} \begin{desc} @@ -966,7 +1078,7 @@ are translated to the actual value. For example, with: \end{verbatim} you might say: \begin{verbatim} -\begin{enumerate}[label=numeric,leftmargin=standard] +\begin{enumerate}[label=numeric, leftmargin=standard] \end{verbatim} So, you can left to the final design what |label=numeric| means. @@ -974,20 +1086,20 @@ So, you can left to the final design what |label=numeric| means. \label{s.inline} Inline lists are ``horizontal'' lists set as ordinary text inside a -paragraph. With this package you can create inline lists, as -explained below, with |\newlist|, which have their own labels and -counters. However, very often inline versions of standard lists, -with the same labelling schema, will be enough -- the package option -|inline| does that. +paragraph. With this package you can create inline lists, as explained +below, with |\newlist|, which have their own labels and counters. +However, very often inline versions of standard lists, with the same +labeling schema, will be enough -- the package option |inline| does +that. \begin{warning} Items are boxed, so floats are lost and nested lists are not allowed (remember many displayed elements are defined as lists). Display math is forbidden too, and due to an optimization done by \TeX{} when - bulding lists, explicit hyphenation may be wrong.\footnote{A Knuthian - ``premature optimization''? Who knows, but anyway Lua\TeX{} has - removed it, so hyphenation with this engine should be correct.} There - was a reason for this default setting, namely, this feature was + building lists, explicit hyphenation may be wrong.\footnote{A + Knuthian ``premature optimization''? Who knows, but anyway Lua\TeX{} + has removed it, so hyphenation with this engine should be correct.} + There was a reason for this default setting, namely, this feature was mainly devised for short items (a few words), and the parameter |itemjoin*| could be useful for logical markup. To overcome these limitations, you may set |mode=unboxed|, described below. @@ -1001,19 +1113,19 @@ with the same labelling schema, will be enough -- the package option With the package option \texttt{inline}, three environments for inline lists are defined: \texttt{enumerate*}, \texttt{itemize*}, and -\texttt{description*}. They emulate the behaviour of -\textsf{paralist} and \textsf{shortlst} in that labels and settings -are shared with the displayed (ie, ``normal'') lists -\texttt{enumerate}, \texttt{itemize} and \texttt{description}, -respectively (however, remember resuming is based on environment -names, not on list types). This applies only to those created with -\texttt{inline} -- inline lists created with |\newlist| as described -below are independent and use their own labels and settings. +\texttt{description*}. They emulate the behavior of \textsf{paralist} +and \textsf{shortlst} in that labels and settings are shared with the +displayed (ie, ``normal'') lists \texttt{enumerate}, \texttt{itemize} +and \texttt{description}, respectively (however, remember resuming is +based on environment names, not on list types). This applies only to +those created with \texttt{inline} -- inline lists created with +|\newlist| as described below are independent and use their own labels +and settings. \begin{note} - Note |inline| is not required if you do not need the inline - versions of standard lists, but instead you define your own - standalone inline lists with |\newlist|. + Note |inline| is not required if you do not need the inline versions + of standard lists, but instead you define your own standalone inline + lists with |\newlist|. \end{note} \begin{warning} @@ -1055,7 +1167,7 @@ before=\unskip{: }, itemjoin={{; }}, itemjoin*={{, and }} If using floats, lists or displayed math inside inline lists is important, use an alternative ``mode'', which you can activate with \texttt{mode=unboxed} (the default is \texttt{mode=boxed}). With it, -floats may be used freely, but misplaced |\item|s are not catched and +floats may be used freely, but misplaced |\item|s are not caught and \texttt{itemjoin*} is ignored (a warning is written to the log about this fact). @@ -1083,10 +1195,12 @@ this package, and those redefined by this package or defined with \setlist[itemize]{leftmargin=*} \setlist[itemize,1]{label=$\triangleleft$} \setlist[enumerate]{labelsep=*, leftmargin=1.5pc} -\setlist[enumerate,1]{label=\arabic*., ref=\arabic*} -\setlist[enumerate,2]{label=\emph{\alph*}), - ref=\theenumi.\emph{\alph*}} -\setlist[enumerate,3]{label=\roman*), ref=\theenumii.\roman*} +\setlist[enumerate,1]{label = \arabic*., + ref = \arabic*} +\setlist[enumerate,2]{label = \emph{\alph*}), + ref = \theenumi.\emph{\alph*}} +\setlist[enumerate,3]{label = \roman*), + ref = \theenumii.\roman*} \setlist[description]{font=\sffamily\bfseries} \end{verbatim} These setting are read in the following order: list, list at the @@ -1119,24 +1233,29 @@ This allows defining lists with the help of loops. \end{warning} \section{Size dependent settings} +\label{s:sized} -\New{3.6} The following package option is requrired for making use of -this feature. +\New{3.6} For settings depending on the font size, in most cases all +you need are relative units like |ex| or |em|. Sometimes, you may want +discrete steps, and a special syntax allows them. + +The following package option is required for making use of this +feature. \begin{desc} |sizes| (package option) \end{desc} Lengths can contain size-based settings as follows (the value before -the first $<$ is a default).% TODO -- An alternative |\setlist<size>|. +the first \texttt{<} is a default). \begingroup \makeatletter \renewcommand\verbatim@font{\normalfont\ttfamily} \begin{verbatim} \setlist{ - topsep= 20pt <-10> 6pt <10-> 40pt, - leftmargin= <-10> 0cm <10> 1cm <10-> 2cm , - rightmargin= <-10> 0cm <10> 1cm <10-> 2cm , + topsep = 20pt <-10> 6pt <10-> 40pt, + leftmargin = <-10> 0cm <10> 1cm <10-> 2cm , + rightmargin = <-10> 0cm <10> 1cm <10-> 2cm , } \end{verbatim} \endgroup @@ -1144,25 +1263,72 @@ the first $<$ is a default).% TODO -- An alternative |\setlist<size>|. Names are accepted, too: |script|, |tiny|, |footnote|, |small|, |normal|, |large|, |Large|, |LARGE|, |huge|, |Huge| (ie, remove `size' from the \LaTeX{} name if necessary). For example: -% TODO - |\SetEnumitemSizes| to configure it. \begingroup \makeatletter \renewcommand\verbatim@font{\normalfont\ttfamily} \begin{verbatim} \setlist{ - topsep= 20pt <-normal> 6pt <normal-> 40pt, - leftmargin= <-normal> 0cm <normal> 1cm <normal-> 2cm , - rightmargin= <-normal> 0cm <normal> 1cm <normal-> 2cm , + topsep = 20pt <-normal> 6pt <normal-> 40pt, + leftmargin = <-normal> 0cm <normal> 1cm <normal-> 2cm , + rightmargin = <-normal> 0cm <normal> 1cm <normal-> 2cm , } \end{verbatim} \endgroup -Single values take precedence over ranges. In ranges, the last match -wins. The range |a-b| is $a \le \mbox{size} < b$ (the lower bound is -included, but not the upper one). These rules allow in the examples -above the setting for |10| or |normal| in the logical place. Remember -nominal sizes are not always the real sizes -- for example, with option -|11pt|, |\normalsize| (and |normal|) is 10.95. +Single values take precedence over ranges (i. e., specific takes +precedence over generic). In ranges, the last match wins. The range +|a-b| is $a \le \mbox{size} < b$ (the lower bound is included, but not +the upper one). These rules allow in the examples above the setting for +|10| or |normal| in the logical place. Remember nominal sizes are not +always the real sizes -- for example, with option |11pt|, |\normalsize| +(and |normal|) is 10.95. You may precede a value with several single +qualifiers like +\texttt{<}|small|\texttt{><}|normal|\texttt{>}|12pt|.\footnote{Note +this syntax follows closely that of \texttt{\string\DeclareFontShape}, +except in the precedence of single values.} A value before the first +\texttt{<..>} is considered a default value. + +\begin{note} + For efficiency reasons, named sizes are assigned only once, when + \textsf{enumitem} is loaded, in the assumption they are set by the + class, or a local style loaded previously. +\end{note} + +\begin{desc} +|\SetEnumitemSize{<name>}{<selector>}| +\end{desc} + +\New{3.7} If sizes are modified after loading \textsf{enumitem} or you +are using a class with non standard sizes (or even you just want +another names), they can be set or reset with the following tool. + +\begin{example} +A trivial example: +\begin{verbatim} +\SetEnumitemSize{normal}{\normalsize} +\SetEnumitemSize{large}{\large} +\end{verbatim} +\end{example} + +\begin{desc} +|\setlist|\texttt{\string<}|<size>|\texttt{\string>}% + |[<names>,<levels>]{<keys/values>}| +\end{desc} + +\New{3.7} An extension to |\setlist| described below which adds the +definitions, but only for the given size (either single or a range). +The precedence rules for sizes also apply here (so that the order of +|\setlist|'s are relevant), and size dependent keys as defined by this +procedure take precedence over the rest of the keys. For example: +\begingroup +\makeatletter +\renewcommand\verbatim@font{\normalfont\ttfamily} +\begin{verbatim} +\setlist<-normal>[enumerate]{nosep} +\end{verbatim} +\endgroup + +However, only a size qualifier is accepted in each |\setlist|. \section{Cloning the basic lists} \label{s.clone} @@ -1201,8 +1367,8 @@ label=\arabic{stepsii}.\arabic{stepsi} \begin{warning} For consistency with the counter naming schema in \LaTeX, list levels - are also named internally with a roman numeral, ie, |<list>|i, - |<list>|ii, |<list>|iii, etc. For this reason (both counter and list + are also named internally with a roman numeral, ie, |<list>i|, + |<list>ii|, |<list>iii|, etc. For this reason (both counter and list names), defining two lists as, say, |books| and |booksi| leads to unexpected results (currently without any warning, which should be fixed). @@ -1235,6 +1401,11 @@ No number (or 0) means ``all levels'' and no name means ``all lists''; no optional argument means ``all lists at all levels''. The starred form |\setlist*| adds the settings to the previous ones. +You may restrict the additions to a certain font size, as explained in +section \ref{s:sized}. It must be noted the latter have a higher +precedence than the starred ones (i. e., settings added for some sizes +take precedence over settings added for all sizes, so that the most +specific value for a key is applied). \begin{desc} |\setlistdepth{<integer>}| @@ -1318,7 +1489,7 @@ because its name is different. \section{Package options} -Besides |inline|, |ignoredisplayed|, |sizes| and +Besides |inline|, |ignoredisplayed|, |sizes|, |series=override| and |shortlabels|, the following option is available. \begin{desc} @@ -1332,15 +1503,15 @@ even redefine the existing ones. \section{The trivlist issue} \LaTeX{} uses a simplified version of |list| named |trivlist| to set -displayed material, like |center|, |verbatim|, |tabbing|, -|theorem|, etc., even if conceptually they are not lists. -Unfortunately, |trivlist| uses the current list settings, which has -the odd side effect that changing the vertical spacing of lists also -changes sometimes the spacing in these environments. +displayed material, like |center|, |tabbing|, |theorem|, etc., even if +conceptually they are not lists. Unfortunately, |trivlist| uses the +current list settings, which has the odd side effect that changing the +vertical spacing of lists also changes sometimes the spacing in these +environments. This package modifies |trivlist| so that the default settings for the current level (ie, those set by the corresponding |clo| -files) are set again. In standard \LaTeX{} that is usually redundand, +files) are set again. In standard \LaTeX{} that is usually redundant, but if we want to fine tune lists, not resetting the default values could be a real issue (particularly if you use the |nosep| option). @@ -1358,8 +1529,6 @@ If for some reason you do not want to change |trivlist| and preserve the original definition, you can use the package option |ignoredisplayed|. -% TODO - Document it may be applied to quote, tabbing, etc. - \New{3.6} If, on the other hand, you want to also apply the changes for all lists to trivlists, just set the package option |includedisplayed|. @@ -1614,7 +1783,7 @@ fields---namely, label, title, and body---, so that enumerate and itemize has label (numbered and unnumbered) but no title, while description has title but no label. In this model, one can have a description with entries marked with labels, as for example (of -course, this simple solution is far from satistactory): +course, this simple solution is far from satisfactory): \begin{verbatim} \newcommand\litem[1]{\item{\bfseries #1,\enspace}} \begin{itemize}[label=\textbullet] @@ -1642,10 +1811,10 @@ no ha mucho tiempo que viv\'{\i}a un hidalgo de los de \hrule \vskip6pt -This format in not infrequent at all and a tool for defining them is -on the way and at a very advanced stage. It has not been include in -version 3.0 because I'm not sure if the proper place is this package -or \textsf{titlesec} and it is not stable enough yet. +% This format in not infrequent at all and a tool for defining them is +% on the way and at a very advanced stage. It has not been include in +% version 3.0 because I'm not sure if the proper place is this package +% or \textsf{titlesec} and it is not stable enough yet. \subsection{Known issues} @@ -1656,15 +1825,15 @@ List resuming is based on environment names, and when a |\newenvironment| contains a list you may want to use |\begin{<list>}| and |\end{<list>}|. Using the corresponding low-level commands (ie, |\<list>| and |\end<list>|) is not an error, but it is your -responsability to make sure the result is correct. +responsibility to make sure the result is correct. -\item The behaviour of mixed boxed labels (including enumerate and +\item The behavior of mixed boxed labels (including enumerate and itemize) and unboxed labels is not well-defined. The same applies to boxed and unboxed inline lists (which could even raise an error). \item Similarly, resuming a series and a list at the same time is allowed, -too, but again its behaviour is not well-defined. +too, but again its behavior is not well-defined. \item (3.5.2) An incompatibility with 2.x has popped up -- if you were using the optional argument to pass a value to a |\ref| or other @@ -1681,9 +1850,9 @@ punctuation between items). Two modes are provided: |boxed| and |unboxed|. \item |\setlist| is \textsf{calc}-savvy (eg, for use in loops), -and you can set diferent lists and levels at once. \item All lengths +and you can set different lists and levels at once. \item All lengths related to labels can take the value |*| (and not only -|labelsep| and |leftmargin|). Its behaviour has been made +|labelsep| and |leftmargin|). Its behavior has been made consistent and there is new value |!| which does not compute the widest label. @@ -1693,9 +1862,9 @@ case you are using |resume|). \item |resume*| can be combined with other keys. \item Lists can be gathered globally using series, so that they are -considered a single list. To start a series just use -|series=<series-name>| and then resume it with |resume=<series-name>| or -|resume*=<series-name>|. +considered a single list. To start a series just use +|series=<series-name>| and then resume it with |resume=<series-name>| +or |resume*=<series-name>|. \item The ``experimental'' |fullwidth| has been replaced by a new key |wide|. @@ -1716,7 +1885,7 @@ has been removed. It is more flexible at the cost of having a more \subsection{Bug fixes} \begin{itemize} -\item Star values (eg, |leftmargin=*|) could not be overriden +\item Star values (eg, |leftmargin=*|) could not be overridden and new values were ignored. \item |nolistsep| as the first of several keys was not always recognized and therefore treated like a short label 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 |