1 % \iffalse meta-comment
4 % The LaTeX3 Project and any individual authors listed elsewhere
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
30 %%% From File: ltlists.dtx
33 \ProvidesFile{ltlists.dtx}
34 [2014/09/29 v1.0s LaTeX Kernel (List Environments)]
36 \documentclass{ltxdoc}
37 \GetFileInfo{ltlists.dtx}
46 Tobias Oetiker\thanks{Tobi has converted the documentation to
60 % \changes{v1.0b}{1994/03/28}{Improve documentation}
61 % \changes{v1.0f}{1994/05/21}{Use new error commands}
62 % \changes{v1.0f}{1995/05/21}{Moved to doc.sty standard}
64 % \section{List, and related environments}
66 % The generic commands for creating an indented environment --
67 % |enumerate|, |itemize|, |quote|, etc -- are:
69 % |\list|\marg{LABEL}\marg{COMMANDS} ... |\endlist|
72 % which can be invoked by the user as the list environment. The LABEL
73 % argument specifies item labeling. COMMANDS contains commands for
74 % changing the horizontal and vertical spacing parameters.
76 % Each item of the environment is begun by the command
77 % |\item[|ITEMLABEL|]|
78 % which produces an item labeled by ITEMLABEL. If the argument is
79 % missing, then the LABEL argument of the |\list| command is used as the
82 % The label is formed by putting |\makelabel|\marg{ITEMLABEL} in an hbox
83 % whose width is either its natural width or else |\labelwidth|,
84 % whichever is larger. The |\list| command defines |\makelabel| to have
85 % the default definition:
87 % |\makelabel|\marg{ARG} == BEGIN |\hfil| ARG END
89 % which, for a label of width less than |\labelwidth|, puts the label
90 % flushright, |\labelsep| to the left of the item's text. However,
91 % |\makelabel| can be |\let| to another command by the |\list|'s
94 % A |\usecounter|\marg{foo} command in the second argument causes the
95 % counter \emph{foo} to be initialized to zero, and stepped by every
96 % |\item| command without an argument. (|\label| commands within the
97 % list refer to this counter.)
99 % When you leave a list environment, returning either to an enclosing
100 % list or normal text mode, LaTeX begins a new paragraph if and only if
101 % you leave a blank line after the |\end| command. This is accomplished
102 % by the |\@endparenv| command.
104 % Blank lines are ignored every other reasonable place--i.e.:
106 % \item Between the |\begin{list}| and the first |\item|,
107 % \item Between the |\item| and the text of that item.
108 % \item Between the end of the last item and the |\end{list}|.
111 % For an environment like quotation, in which items are not labeled,
112 % the entire environment is a single item. It is defined by
113 % letting |\quotation| == |\list{}{...}\item\relax|. (Note the
114 % |\relax|, there in case the first character in the environment is a
115 % '['.) The spacing parameters provide a great deal of flexability in
116 % designing the format, including the ability to let the indentation of
117 % the first paragraph be different from that of the subsequent ones.
119 % The trivlist environment is equivalent to a list environment
120 % whose second argument sets the following parameter values:
121 % \begin{description}
122 % \item[\cs{leftmargin} = 0:] causes no indentation of left margin
123 % \item[\cs{labelwidth} = 0:] see below for precise effect this has.
124 % \item[\cs{itemindent} = 0:] with a null label, makes first paragraph
125 % have no indentation. Succeeding paragraphs have |\parindent|
126 % indentation. To give first paragraph same indentation, set
127 % |\itemindent| = |\parindent| before the |\item[]|.
130 % Every |\item| in a trivlist environment must have an argument---in
131 % many cases, this will be the null argument (|\item[]|). The trivlist
132 % environment is mainly used for paragraphing environments, like
133 % verbatim, in which there is no margin change. It provides the same
134 % vertical spacing as the list environment, and works reasonably well
135 % when it occurs immediately after an |\item| command in an enclosing
141 % \changes{v1.0a}{1994/03/07}{Initial version, split from latex.dtx}
142 % \changes{v1.0a}{1994/03/07}{Long lines wrapped to 72 columns}
145 % \subsection{List and Trivlist}
148 % The following variables are used inside a list environment:
149 % \begin{description}
150 % \item[\cs{@totalleftmargin}] The distance that the prevailing left
151 % margin is indented from the outermost left margin,
152 % \item[\cs{linewidth}] The width of the current line. Must be
153 % initialized to |\hsize|.
154 % \item[\cs{@listdepth}] A count for holding current list nesting depth.
155 % \item[\cs{makelabel}] A macro with a single argument, used to
156 % generate the label from the argument (given or implied)
157 % of the |\item| command. Initialized to |\@mklab| by the |\list|
158 % command. This command must produce some stretch---i.e., an
160 % \item[\cs{@inlabel}] A switch that is false except between the time
161 % an |\item| is encountered and the time that \TeX{}
162 % actually enters horizontal mode. Should be tested by commands
163 % that can be messed up by the list environment's use of |\everypar|.
164 % \item[\cs{box}\cs{@labels}] When |@inlabel = true|, it holds the labels
165 % to be put out by |\everypar|.
166 % \item[\texttt{@noparitem}] A switch set by |\list| when
168 % Handles the case of a |\list| being the first thing in an item.
169 % \item[\texttt{@noparlist}] A switch set true for a list that begins an
170 % item. No |\topsep| space is added before or after |\item|'s such a
172 % \item[\texttt{@newlist}] Set true by |\list|, set false by the first
173 % text (by |\everypar|).
174 % \item[\texttt{@noitemarg}] Set true when executing an |\item| with no
175 % explicit argument. Used to save space. To save time, make two
176 % separate |\@item| commands.
177 % \item[\texttt{@nmbrlist}] Set true by |\usecounter| command, causes
178 % list to be numbered.
179 % \item[\cs{@listctr}] |\def|'ed by |\usecounter| to name of counter.
180 % \item[\cs{@noskipsec}] A switch set true by a sectioning command when
181 % it is creating an in-text heading with |\everypar|.
184 % Throughout a list environment, |\hsize| is the width of the current
185 % line, measured from the outermost left margin to the outermost right
186 % margin. Environments like tabbing should use |\linewidth| instead of
189 % Here are the parameters of a list that can be set by commands in
190 % the |\list|'s COMMANDS argument. These parameters are all TeX
191 % skips or dimensions (defined by |\newskip| or |\newdimen|), so the
192 % usual \TeX\ or \LaTeX\ commands can be used to set them. The
193 % commands will be executed in vmode if and only if the |\list| was
194 % preceded by a |\par| (or something like an |\end{list}|), so the
195 % spacing parameters can be set according to whether the list is
196 % inside a paragraph or is its own paragraph.
199 % \subsection{Vertical Spacing (skips)}
200 % \begin{description}
201 % \item[\cs{topsep}:] Space between first item and preceding paragraph.
202 % \item[\cs{partopsep}:] Extra space added to \cs{topsep} when
203 % environment starts a new paragraph (is called in vmode).
204 % \item[\cs{itemsep}:] Space between successive items.
205 % \item[\cs{parsep}:] Space between paragraphs within an item -- the
206 % \cs{parskip} for this environment.
209 % \subsection{Penalties}
210 % \begin{description}
212 % \item[\cs{@beginparpenalty}:] put at the beginning of a list
213 % \item[\cs{@endparpenalty}:] put at end of list
214 % \item[\cs{@itempenalty}:] put between items.
217 % \subsection{Horizontal Spacing (dimens)}
218 % \begin{description}
219 % \item[\cs{leftmargin}:] space between left margin of enclosing
220 % environment (or of page if top level list) and left margin of
221 % this list. Must be nonnegative.
222 % \item[\cs{rightmargin}:] analogous.
223 % \item[\cs{listparindent}:] extra indentation at beginning of every
224 % paragraph of a list except the one started by the \cs{item}
225 % command. May be negative! Usually, labeled
226 % lists have \cs{listparindent} equal to zero.
227 % \item[\cs{itemindent}:] extra indentation added right BEFORE an item
229 % \item[\cs{labelwidth}:] nominal width of box that contains the label.
230 % If the natural width of the
231 % label $< =$ \cs{labelwidth},
232 % then the label is flushed right inside a box
233 % of width \cs{labelwidth} (with an \cs{hfil}).
235 % a box of the natural width is employed, which
236 % causes an indentation of the text on that line.
237 % \item[\cs{labelsep}:] space between end of label box and text of
240 % \subsection{Default Values}
241 % Defaults for the list environment are set as follows.
242 % First, \cs{rightmargin}, \cs{listparindent} and \cs{itemindent}
244 % to 0pt. Then, one of the commands
245 % \cs{@listi}, \cs{@listii}, ... , \cs{@listvi}
246 % is called, depending upon the current level of the list.
247 % The \cs{@list} \ldots commands should be defined by the document
248 % style. A convention that the document style should follow is
249 % to set \cs{leftmargin} to
250 % \cs{leftmargini},\ldots, \cs{leftmarginvi} for
251 % the appropriate level. Items that aren't changed may be left
252 % alone, but everything that could possibly be changed must be
254 % \begin{oldcomments}
255 % \list{LABEL}{COMMANDS} ==
258 % then LaTeX error: 'Too deeply nested'
259 % else \@listdepth :=G \@listdepth + 1
261 % \rightmargin := 0pt
262 % \listparindent := 0pt
264 % \eval(@list \romannumeral\the\@listdepth) %% Set default values:
265 % \@itemlabel :=L LABEL
266 % \makelabel == \@mklab
267 % @nmbrlist :=L false
270 % \@trivlist % commands common to \list and \trivlist
272 % \parskip :=L \parsep
273 % \parindent :=L \listparindent
274 % \linewidth :=L \linewidth - \rightmargin -\leftmargin
275 % \@totalleftmargin :=L \@totalleftmargin + \leftmargin
276 % \parshape 1 \@totalleftmargin \linewidth
277 % \ignorespaces % gobble space up to \item
280 % \endlist == BEGIN \@listdepth :=G \@listdepth -1
286 % if @newlist = T then \@noitemerr fi
287 % %% This command removed for some forgotten reason.
288 % \@topsepadd :=L \topsep
289 % if @noskipsec then leave vertical mode fi %% Added 11 Jun 85
291 % then \@topsepadd :=L \@topsepadd + \partopsep
292 % else \unskip \par % remove glue from end of last line
295 % then @noparitem :=L true
296 % @noparlist :=L true
297 % else @noparlist :=L false
298 % \@topsep :=L \@topsepadd
300 % \@topsep :=L \@topsep + \parskip %% Change 4 Sep 85
301 % \leftskip :=L 0pt % Restore paragraphing parameters
302 % \rightskip :=L \@rightskip
303 % \parfillskip :=L 0pt + 1fil
305 % NOTE: \@setpar called on every \list in case \par has been
306 % temporarily munged before the \list command.
307 % \@setpar{if @newlist = false then {\@@par} fi}
309 % \@outerparskip :=L \parskip
314 % \parsep := \parskip
319 % \itemindent := \parindent
320 % \@itemlabel :=L "empty" %% added 93/12/13
321 % \makelabel{LABEL} == LABEL
326 % if @inlabel = T then \indent fi
327 % if horizontal mode then \unskip \par fi
328 % if @noparlist = true
329 % else if \lastskip > 0
330 % then \@tempskipa := \lastskip
332 % \vskip \@tempskipa -\@outerparskip + \parskip
340 % \addpenalty{@endparpenalty}
341 % \addvspace{\@topsepadd}
342 % \endgroup %% ends the \begin command's \begingroup
348 % \everypar == BEGIN remove \lastbox \everypar{} END
349 % \begingroup %% to match the \end commands \endgroup
352 % \item == BEGIN if math mode then WARNING fi
355 % else @noitemarg := true
361 % if @noparitem = true
362 % then @noparitem := false
363 % % NOTE: then clause hardly every taken,
364 % % so made a macro \@donoparitem
365 % \box\@labels :=G \hbox{\hskip -\leftmargin
367 % \hskip \leftmargin }
368 % if @minipage = false then
369 % \@tempskipa := \lastskip
371 % \vskip \@tempskipa + \@outerparskip - \parskip
373 % else if @inlabel = true
374 % then \indent \par % previous item empty.
376 % if hmode then 2 \unskip's
377 % % To remove any space at end of prev.
378 % % paragraph that could cause a blank line.
382 % then if @nobreak = T % Kludge if list follows \section
383 % then \addvspace{\@outerparskip - \parskip}
384 % else \addpenalty{\@beginparpenalty}
385 % \addvspace{\@topsep}
386 % \addvspace{-\parskip} %% added 4 Sep 85
388 % else \addpenalty{\@itempenalty}
389 % \addvspace{\itemsep}
394 % \everypar{ @minipage :=G F
397 % then @inlabel :=G false
401 % %% 3 Oct 85 -- allow line break here
402 % \box\@labels :=G null
406 % if @noitemarg = true
407 % then @noitemarg := false
409 % then \refstepcounter{\@listctr}
411 % \@tempboxa :=L \hbox{\makelabel{LAB}}
412 % \box\@labels :=G \@labels \hskip \itemindent
413 % \hskip - (\labelwidth + \labelsep)
414 % if \wd \@tempboxa > \labelwidth
415 % then \box\@tempboxa
416 % else \hbox to \labelwidth {\unhbox\@tempboxa}
419 % \ignorespaces %gobble space up to text
422 % \makelabel{LABEL} == ERROR %% default to catch lonely \item
425 % \usecounter{CTR} == BEGIN @nmbrlist :=L true
427 % \setcounter{CTR}{0}
430 % DEFINE \dimen's and \count
432 % \begin{macro}{\topskip}
433 % \begin{macro}{\partopsep}
434 % \begin{macro}{\itemsep}
435 % \begin{macro}{\parsep}
436 % \begin{macro}{\@topsep}
437 % \begin{macro}{\@topsepadd}
438 % \begin{macro}{\outerparskip}
447 \newskip\@outerparskip
449 % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
451 % \begin{macro}{\leftmargin}\begin{macro}{\rightmargin}
452 % \begin{macro}{\listparindent}\begin{macro}{\itemindent}
453 % \begin{macro}{\labelwidth}\begin{macro}{\labelsep}
454 % \begin{macro}{\@totalleftmargin}
457 \newdimen\rightmargin
458 \newdimen\listparindent
463 \newdimen\@totalleftmargin \@totalleftmargin=\z@
465 % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
466 % \end{macro}\end{macro}
468 % \begin{macro}{\leftmargini}
469 % \begin{macro}{\leftmarginii}
470 % \begin{macro}{\leftmarginiii}
471 % \begin{macro}{\leftmarginiv}
472 % \begin{macro}{\leftmarginv}
473 % \begin{macro}{\leftmarginvi}
475 \newdimen\leftmargini
476 \newdimen\leftmarginii
477 \newdimen\leftmarginiii
478 \newdimen\leftmarginiv
479 \newdimen\leftmarginv
480 \newdimen\leftmarginvi
482 % \end{macro}\end{macro}\end{macro}
483 % \end{macro}\end{macro}\end{macro}
485 % \begin{macro}{\@listdepth}\begin{macro}{\@itempenalty}
486 % \begin{macro}{\@beginparpenalty}\begin{macro}{\@endparpenalty}
488 \newcount\@listdepth \@listdepth=0
489 \newcount\@itempenalty
490 \newcount\@beginparpenalty
491 \newcount\@endparpenalty
493 % \end{macro}\end{macro}\end{macro}\end{macro}
495 % \begin{macro}{\@labels}
501 % \begin{macro}{\if@inlabel}
502 % \begin{macro}{\@inlabelfalse}
503 % \begin{macro}{\@inlabeltrue}
505 \newif\if@inlabel \@inlabelfalse
507 % \end{macro}\end{macro}\end{macro}
509 % \begin{macro}{\if@newlist}
510 % \begin{macro}{\@newlistfalse}
511 % \begin{macro}{\@newlisttrue}
513 \newif\if@newlist \@newlistfalse
515 % \end{macro}\end{macro}\end{macro}
517 % \begin{macro}{\if@noparitem}
518 % \begin{macro}{\@noparitemfalse}
519 % \begin{macro}{\@noparitemtrue}
521 \newif\if@noparitem \@noparitemfalse
523 % \end{macro}\end{macro}\end{macro}
525 % \begin{macro}{\if@noparlist}
526 % \begin{macro}{\@noparlistfalse}
527 % \begin{macro}{\@noparlisttrue}
529 \newif\if@noparlist \@noparlistfalse
531 % \end{macro}\end{macro}\end{macro}
533 % \begin{macro}{\if@noitemarg}
534 % \begin{macro}{\@noitemargfalse}
535 % \begin{macro}{\@noitemargtrue}
537 \newif\if@noitemarg \@noitemargfalse
539 % \end{macro}\end{macro}\end{macro}
541 % \begin{macro}{\if@newlist}
542 % \begin{macro}{\@newlistfalse}
543 % \begin{macro}{\@newlisttrue}
545 \newif\if@nmbrlist \@nmbrlistfalse
547 % \end{macro}\end{macro}\end{macro}
549 % \begin{macro}{\list}
552 \ifnum \@listdepth >5\relax
555 \global\advance\@listdepth\@ne
560 \csname @list\romannumeral\the\@listdepth\endcsname
562 \let\makelabel\@mklab
567 \parindent\listparindent
568 \advance\linewidth -\rightmargin
569 \advance\linewidth -\leftmargin
570 \advance\@totalleftmargin \leftmargin
571 \parshape \@ne \@totalleftmargin \linewidth
576 % \begin{macro}{\par@deathcycles}
578 \newcount\par@deathcycles
582 % \begin{macro}{\@trivlist}
583 % \changes{v1.0e}{1994/12/02}{RmS: Added check for looping}
584 % \changes{v1.0p}{1996/10/31}{Added check for missing item in outer
586 % \changes{v1.0q}{1996/11/04}{Moved check for missing item: only checked
587 % when not inlabel flag is false}
588 % Because |\par| is sometimes made a no-op it is possible for a missing
589 % |\item| to produce a loop that does not fill memory and so never gets
590 % trapped by \TeX. We thus need to trap this here by seting |\par| to
591 % count the number of times a paragraph ii is called with no progress
592 % being made started.
595 \if@noskipsec \leavevmode \fi
598 \advance\@topsepadd \partopsep
606 \if@newlist \@noitemerr \fi
610 \advance\@topsep \parskip
612 \rightskip \@rightskip
613 \parfillskip \@flushglue
616 \advance\par@deathcycles \@ne
617 \ifnum \par@deathcycles >\@m
624 \global \@newlisttrue
625 \@outerparskip \parskip}
629 % \changes{0.0}{1992/03/18}{RmS: added \cs{@nmbrlistfalse}}
630 % \begin{macro}{\trivlist}
641 % We initialise |\@itemlabel| so that a \texttt{trivlist} with
642 % an |\item| not having an optional argument doesn't produce an
644 % \changes{latex2e}{1993/12/13}{Initialised \cs{@itemlabel}}
646 \let\@itemlabel\@empty
647 \def\makelabel##1{##1}}
651 % \begin{macro}{\endlist}
654 \global\advance\@listdepth\m@ne
659 % The definition of \cs{trivlist} used to be in ltspace.dtx
660 % so that other commands could be `let to it'.
661 % They now use \cs{def}.
662 % \begin{macro}{\endtrivlist}
663 % \changes{v1.2b ltspace}{1994/11/12}{Changed order of tests to make
664 % \cs{@noitemerror} correct: end of an era.}
665 % \changes{v1.0i}{1995/05/25}{Macros moved from ltspace.dtx}
666 % \changes{v1.0n}{1996/10/25}{Change \cs{indent} to \cs{leavevmode}}
667 % \changes{v1.0n}{1996/10/25}{Reset flags explicitly}
668 % \changes{v1.0o}{1996/10/26}{Correct typo}
673 \global \@inlabelfalse
677 \global \@newlistfalse
681 % We also check if we are in math mode and issue an error message
682 % if so (hoping that |\@currenvir| resolves suitably). Otherwise
683 % the usual ``perhaps a missing item'' error will get triggered
684 % later which is confusing.
685 % \changes{v1.0s}{2002/10/28}{Check for math mode (pr/3437)}
688 \@inmatherr{\end{\@currenvir}}%
692 \@tempskipa\lastskip \vskip -\lastskip
693 \advance\@tempskipa\parskip \advance\@tempskipa -\@outerparskip
704 % \begin{macro}{\@endparenv}
705 % \begin{macro}{\@doendpe}
706 % To suppress the paragraph indentation in text immediately following
707 % a paragraph-making environment, \cs{everypar} is changed to remove the
708 % space, and \cs{par} is redefined to restore \cs{everypar}. Instead of
709 % redefining \cs{par} and \cs{everypar}, \cs{@endparenv} was changed to
710 % set the @endpe switch, letting \cs{end} redefine \cs{par} and
713 % This allows paragraph-making environments to work right when called
714 % by other environments. (Changed 27 Oct 86)
717 \addpenalty\@endparpenalty\addvspace\@topsepadd\@endpetrue}
721 \def\@doendpe{\@endpetrue
722 \def\par{\@restorepar\everypar{}\par\@endpefalse}\everypar
725 % Use |\setbox0=\lastbox| instead of |\hskip -\parindent|
726 % so that a \cs{noindent} becomes a no-op when used before
727 % a line immediately following a list environment(23 Oct 86).
728 % \changes{v1.0k}{1995/11/07}{Enclosed \cs{setbox0} assignment by a
729 % group so that it leaves the contents of box $0$ intact.}
731 {{\setbox\z@\lastbox}\everypar{}\@endpefalse}}
737 % \begin{macro}{\if@endpe}
738 % \begin{macro}{\@endpefalse}
739 % \begin{macro}{\@endpeltrue}
744 % \end{macro}\end{macro}\end{macro}
747 % \begin{macro}{\@mklab}
749 \def\@mklab#1{\hfil #1}
753 % \changes{LaTeX2.09}{1992/09/18}
754 % {(RmS) Added warning if \cs{item} is used in math mode}
755 % \changes{v1.0c}{1994/04/28}
756 % {Replaced \cs{@ltxnomath} by \cs{@inmatherr}}
757 % \changes{v1.0d}{1994/05/03}
758 % {Removed superfluous braces}
759 % \begin{macro}{\item}
763 \@ifnextchar [\@item{\@noitemargtrue \@item[\@itemlabel]}}
766 % \begin{macro}{\@donoparitem}
770 \global\setbox\@labels\hbox{\hskip -\leftmargin
776 \advance\@tempskipa\@outerparskip
777 \advance\@tempskipa -\parskip
783 % \begin{macro}{\@item}
784 % \changes{v1.0l}{1996/07/26}{Remove unecessary \cs{global} before
801 \addpenalty\@beginparpenalty
803 \addvspace{-\parskip}%
806 \addpenalty\@itempenalty
813 \global\@newlistfalse
815 % This |\if@inlabel| check is needed in case an item starts of
816 % inside a group so that |\everypar| does not become empty
817 % outside that group.
818 % \@nobreakfalse, etc etc.
821 \global\@inlabelfalse
823 % The paragraph indent is now removed by using |\setbox...| since
824 % this makes |\noindent| a no-op here, as it should be. Thus the
825 % following comment is redundant but is left here for the sake of
827 % this next command was changed from an hskip to a kern to avoid
828 % a break point after the parindent box: the skip could cause a
829 % line-break if a very long label occurs in raggedright setting.
830 % \changes{v1.0d}{1994/05/03}{\cs{hskip} changed to \cs{kern}}
831 % \changes{v1.0m}{1996/10/23}{\cs{kern...} changed to \cs{setbox...}}
832 % \changes{v1.0r}{1997/02/21}
833 % {\cs{ifvoid} check added for \cs{noindent}. latex/2414}
834 % If |\noindent| was used after |\item| want to cancel the |\itemindent|
835 % skip. This case can be detected as the indentation box will be void.
848 % This code is intended to prevent a page break after the first
849 % line of an item that comes immediately after a section title. It
850 % may be sensible to always forbid a page break after one line of
851 % an item? As with all such settings of |\clubpenalty| it is local
852 % so will have no effect if the item starts in a group.
854 % Only resetting |\@nobreak| when it is true is now
855 % essential since now it is sometimes set locally.
856 % \changes{v1.0m}{1996/10/23}{Added setting of \cs{clubpenalty} and
857 % set \cs{@nobreakfalse} only when necessary}
863 \clubpenalty \@clubpenalty
867 % \changes{v1.0l}{1996/07/26}{Remove unecessary \cs{global} before
869 % \changes{v1.0m}{1996/10/23}{\cs{@nobreak...} moved into the
870 % \cs{everypar} and not executed unconditionally, see above}
876 % \changes{v1.0g}{1995/05/17}{Removed surplus braces}
878 \refstepcounter\@listctr
882 % We use |\sbox| to support colour commands.
883 % \changes{LaTeX2e}{1993/12/08}{use \cs{sbox} to support colour}
885 \sbox\@tempboxa{\makelabel{#1}}%
886 \global\setbox\@labels\hbox{%
891 \ifdim \wd\@tempboxa >\labelwidth
894 % \changes{LaTeX2.09}{1991/11/22}
895 % {(RmS) Changed second call to \cs{makelabel} to
896 % \cs{unhbox}\cs{@tempboxa}.
897 % Avoids problems with side effects in \cs{makelabel} and is
901 \hbox to\labelwidth {\unhbox\@tempboxa}%
908 % \begin{macro}{\makelabel}
909 % \changes{LaTeX2.09}{1991/11/04}
910 % {(RmS) added default definition for \cs{makelabel},
911 % to produce an error message.}
914 \@latex@error{Lonely \string\item--perhaps a missing
915 list environment}\@ehc}
919 % \begin{macro}{\@nbitem}
920 % \changes{v1.0g}{1995/05/17}{Removed surplus braces}
923 \@tempskipa\@outerparskip
924 \advance\@tempskipa -\parskip
925 \addvspace\@tempskipa}
929 % \begin{macro}{\usecounter}
931 \def\usecounter#1{\@nmbrlisttrue\def\@listctr{#1}\setcounter{#1}\z@}
936 % \subsection{Itemize and Enumerate}
938 % Enumeration is done with four counters: |enumi|, |enumii|, |enumiii|
939 % and |enumiv|, where |enum|N controls the numbering of the Nth level
940 % enumeration. The label is generated by the commands
941 % \cs{labelenumi} \ldots{} \cs{labelenumiv}, which should be defined
942 % by the document style.
943 % Note that \cs{p@enum}N\cs{theenum}N defines the output
944 % of a \cs{ref} command. A typical definition might be:
946 % \def\theenumii{\alph{enumii}}
947 % \def\p@enumii{\theenumi}
948 % \def\labelenumii{(\theenumii)}
950 % which will print the labels as `(a)', `(b)', \ldots
951 % and print a \cs{ref} as `3a'.
953 % The item numbers are moved to the right of the label box, so they are
954 % always a distance of \cs{labelsep} from the item.
956 % \cs{@enumdepth} holds the current enumeration nesting depth.
958 % Itemization is controlled by four commands: \cs{labelitemi},
960 % \cs{labelitemiii}, and \cs{labelitemiv}.
961 % To cause the second-level list to be
962 % bulleted, you just define \cs{labelitemii}
963 % to be $\bullet$. \cs{@itemspacing}
964 % and \cs{@itemdepth} are the analogs of \cs{@enumspacing} and
967 % \begin{oldcomments}
971 % then errormessage: ``Too deeply nested''.
972 % else \@enumdepth :=L \@enumdepth + 1
973 % \@enumctr :=L eval(enum@\romannumeral\the\@enumdepth)
974 % \list{\label(\@enumctr)}
975 % {\usecounter{\@enumctr}
976 % \makelabel{LABEL} == \hss \llap{LABEL}}
980 % \endenumerate == \endlist
983 % \begin{macro}{\@enumdepth}
985 \newcount\@enumdepth \@enumdepth = 0
989 % \begin{macro}{\c@enumi}
990 % \begin{macro}{\c@enumii}
991 % \begin{macro}{\c@enumii}
992 % \begin{macro}{\c@enumiv}
994 \@definecounter{enumi}
995 \@definecounter{enumii}
996 \@definecounter{enumiii}
997 \@definecounter{enumiv}
1004 % \begin{environment}{enumerate}
1005 % \changes{v1.0g}{1995/05/17}{Use \cs{thr@@} and remove surplus braces}
1008 \ifnum \@enumdepth >\thr@@\@toodeep\else
1009 \advance\@enumdepth\@ne
1010 \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
1013 % \changes{v1.0j}{1995/07/09}{Use \cs{expandafter}}
1017 \csname label\@enumctr\endcsname
1018 {\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
1023 \let\endenumerate =\endlist
1028 % \begin{oldcomments}
1031 % if \@itemdepth > 3
1032 % then errormessage: 'Too deeply nested'.
1033 % else \@itemdepth :=L \@itemdepth + 1
1034 % \@itemitem == eval(labelitem\romannumeral\the\@itemdepth)
1035 % \list{\@nameuse{\@itemitem}}
1036 % {\makelabel{LABEL} == \hss \llap{LABEL}}
1040 % \enditemize == \endlist
1044 % \begin{macro}{\@itemdepth}
1046 \newcount\@itemdepth \@itemdepth = 0
1050 % \begin{environment}{itemize}
1051 % \changes{v1.0g}{1995/05/17}{Use \cs{thr@@}}
1054 \ifnum \@itemdepth >\thr@@\@toodeep\else
1055 \advance\@itemdepth\@ne
1056 \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
1059 % \changes{v1.0j}{1995/07/09}{Use \cs{expandafter}}
1063 \csname\@itemitem\endcsname
1064 {\def\makelabel##1{\hss\llap{##1}}}%
1069 \let\enditemize =\endlist