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 [2015/05/10 v1.0t LaTeX Kernel (List Environments)]
36 \documentclass{ltxdoc}
37 \GetFileInfo{ltlists.dtx}
46 Tobias Oetiker\thanks{Tobi has converted the documentation to
52 \MaintainedByLaTeXTeam{latex}
61 % \changes{v1.0b}{1994/03/28}{Improve documentation}
62 % \changes{v1.0f}{1994/05/21}{Use new error commands}
63 % \changes{v1.0f}{1995/05/21}{Moved to doc.sty standard}
65 % \section{List, and related environments}
67 % The generic commands for creating an indented environment --
68 % |enumerate|, |itemize|, |quote|, etc -- are:
70 % |\list|\marg{LABEL}\marg{COMMANDS} ... |\endlist|
73 % which can be invoked by the user as the list environment. The LABEL
74 % argument specifies item labeling. COMMANDS contains commands for
75 % changing the horizontal and vertical spacing parameters.
77 % Each item of the environment is begun by the command
78 % |\item[|ITEMLABEL|]|
79 % which produces an item labeled by ITEMLABEL. If the argument is
80 % missing, then the LABEL argument of the |\list| command is used as the
83 % The label is formed by putting |\makelabel|\marg{ITEMLABEL} in an hbox
84 % whose width is either its natural width or else |\labelwidth|,
85 % whichever is larger. The |\list| command defines |\makelabel| to have
86 % the default definition:
88 % |\makelabel|\marg{ARG} == BEGIN |\hfil| ARG END
90 % which, for a label of width less than |\labelwidth|, puts the label
91 % flushright, |\labelsep| to the left of the item's text. However,
92 % |\makelabel| can be |\let| to another command by the |\list|'s
95 % A |\usecounter|\marg{foo} command in the second argument causes the
96 % counter \emph{foo} to be initialized to zero, and stepped by every
97 % |\item| command without an argument. (|\label| commands within the
98 % list refer to this counter.)
100 % When you leave a list environment, returning either to an enclosing
101 % list or normal text mode, LaTeX begins a new paragraph if and only if
102 % you leave a blank line after the |\end| command. This is accomplished
103 % by the |\@endparenv| command.
105 % Blank lines are ignored every other reasonable place--i.e.:
107 % \item Between the |\begin{list}| and the first |\item|,
108 % \item Between the |\item| and the text of that item.
109 % \item Between the end of the last item and the |\end{list}|.
112 % For an environment like quotation, in which items are not labeled,
113 % the entire environment is a single item. It is defined by
114 % letting |\quotation| == |\list{}{...}\item\relax|. (Note the
115 % |\relax|, there in case the first character in the environment is a
116 % '['.) The spacing parameters provide a great deal of flexability in
117 % designing the format, including the ability to let the indentation of
118 % the first paragraph be different from that of the subsequent ones.
120 % The trivlist environment is equivalent to a list environment
121 % whose second argument sets the following parameter values:
122 % \begin{description}
123 % \item[\cs{leftmargin} = 0:] causes no indentation of left margin
124 % \item[\cs{labelwidth} = 0:] see below for precise effect this has.
125 % \item[\cs{itemindent} = 0:] with a null label, makes first paragraph
126 % have no indentation. Succeeding paragraphs have |\parindent|
127 % indentation. To give first paragraph same indentation, set
128 % |\itemindent| = |\parindent| before the |\item[]|.
131 % Every |\item| in a trivlist environment must have an argument---in
132 % many cases, this will be the null argument (|\item[]|). The trivlist
133 % environment is mainly used for paragraphing environments, like
134 % verbatim, in which there is no margin change. It provides the same
135 % vertical spacing as the list environment, and works reasonably well
136 % when it occurs immediately after an |\item| command in an enclosing
142 % \changes{v1.0a}{1994/03/07}{Initial version, split from latex.dtx}
143 % \changes{v1.0a}{1994/03/07}{Long lines wrapped to 72 columns}
146 % \subsection{List and Trivlist}
149 % The following variables are used inside a list environment:
150 % \begin{description}
151 % \item[\cs{@totalleftmargin}] The distance that the prevailing left
152 % margin is indented from the outermost left margin,
153 % \item[\cs{linewidth}] The width of the current line. Must be
154 % initialized to |\hsize|.
155 % \item[\cs{@listdepth}] A count for holding current list nesting depth.
156 % \item[\cs{makelabel}] A macro with a single argument, used to
157 % generate the label from the argument (given or implied)
158 % of the |\item| command. Initialized to |\@mklab| by the |\list|
159 % command. This command must produce some stretch---i.e., an
161 % \item[\cs{@inlabel}] A switch that is false except between the time
162 % an |\item| is encountered and the time that \TeX{}
163 % actually enters horizontal mode. Should be tested by commands
164 % that can be messed up by the list environment's use of |\everypar|.
165 % \item[\cs{box}\cs{@labels}] When |@inlabel = true|, it holds the labels
166 % to be put out by |\everypar|.
167 % \item[\texttt{@noparitem}] A switch set by |\list| when
169 % Handles the case of a |\list| being the first thing in an item.
170 % \item[\texttt{@noparlist}] A switch set true for a list that begins an
171 % item. No |\topsep| space is added before or after |\item|'s such a
173 % \item[\texttt{@newlist}] Set true by |\list|, set false by the first
174 % text (by |\everypar|).
175 % \item[\texttt{@noitemarg}] Set true when executing an |\item| with no
176 % explicit argument. Used to save space. To save time, make two
177 % separate |\@item| commands.
178 % \item[\texttt{@nmbrlist}] Set true by |\usecounter| command, causes
179 % list to be numbered.
180 % \item[\cs{@listctr}] |\def|'ed by |\usecounter| to name of counter.
181 % \item[\cs{@noskipsec}] A switch set true by a sectioning command when
182 % it is creating an in-text heading with |\everypar|.
185 % Throughout a list environment, |\hsize| is the width of the current
186 % line, measured from the outermost left margin to the outermost right
187 % margin. Environments like tabbing should use |\linewidth| instead of
190 % Here are the parameters of a list that can be set by commands in
191 % the |\list|'s COMMANDS argument. These parameters are all TeX
192 % skips or dimensions (defined by |\newskip| or |\newdimen|), so the
193 % usual \TeX\ or \LaTeX\ commands can be used to set them. The
194 % commands will be executed in vmode if and only if the |\list| was
195 % preceded by a |\par| (or something like an |\end{list}|), so the
196 % spacing parameters can be set according to whether the list is
197 % inside a paragraph or is its own paragraph.
200 % \subsection{Vertical Spacing (skips)}
201 % \begin{description}
202 % \item[\cs{topsep}:] Space between first item and preceding paragraph.
203 % \item[\cs{partopsep}:] Extra space added to \cs{topsep} when
204 % environment starts a new paragraph (is called in vmode).
205 % \item[\cs{itemsep}:] Space between successive items.
206 % \item[\cs{parsep}:] Space between paragraphs within an item -- the
207 % \cs{parskip} for this environment.
210 % \subsection{Penalties}
211 % \begin{description}
213 % \item[\cs{@beginparpenalty}:] put at the beginning of a list
214 % \item[\cs{@endparpenalty}:] put at end of list
215 % \item[\cs{@itempenalty}:] put between items.
218 % \subsection{Horizontal Spacing (dimens)}
219 % \begin{description}
220 % \item[\cs{leftmargin}:] space between left margin of enclosing
221 % environment (or of page if top level list) and left margin of
222 % this list. Must be nonnegative.
223 % \item[\cs{rightmargin}:] analogous.
224 % \item[\cs{listparindent}:] extra indentation at beginning of every
225 % paragraph of a list except the one started by the \cs{item}
226 % command. May be negative! Usually, labeled
227 % lists have \cs{listparindent} equal to zero.
228 % \item[\cs{itemindent}:] extra indentation added right BEFORE an item
230 % \item[\cs{labelwidth}:] nominal width of box that contains the label.
231 % If the natural width of the
232 % label $< =$ \cs{labelwidth},
233 % then the label is flushed right inside a box
234 % of width \cs{labelwidth} (with an \cs{hfil}).
236 % a box of the natural width is employed, which
237 % causes an indentation of the text on that line.
238 % \item[\cs{labelsep}:] space between end of label box and text of
241 % \subsection{Default Values}
242 % Defaults for the list environment are set as follows.
243 % First, \cs{rightmargin}, \cs{listparindent} and \cs{itemindent}
245 % to 0pt. Then, one of the commands
246 % \cs{@listi}, \cs{@listii}, ... , \cs{@listvi}
247 % is called, depending upon the current level of the list.
248 % The \cs{@list} \ldots commands should be defined by the document
249 % style. A convention that the document style should follow is
250 % to set \cs{leftmargin} to
251 % \cs{leftmargini},\ldots, \cs{leftmarginvi} for
252 % the appropriate level. Items that aren't changed may be left
253 % alone, but everything that could possibly be changed must be
255 % \begin{oldcomments}
256 % \list{LABEL}{COMMANDS} ==
259 % then LaTeX error: 'Too deeply nested'
260 % else \@listdepth :=G \@listdepth + 1
262 % \rightmargin := 0pt
263 % \listparindent := 0pt
265 % \eval(@list \romannumeral\the\@listdepth) %% Set default values:
266 % \@itemlabel :=L LABEL
267 % \makelabel == \@mklab
268 % @nmbrlist :=L false
271 % \@trivlist % commands common to \list and \trivlist
273 % \parskip :=L \parsep
274 % \parindent :=L \listparindent
275 % \linewidth :=L \linewidth - \rightmargin -\leftmargin
276 % \@totalleftmargin :=L \@totalleftmargin + \leftmargin
277 % \parshape 1 \@totalleftmargin \linewidth
278 % \ignorespaces % gobble space up to \item
281 % \endlist == BEGIN \@listdepth :=G \@listdepth -1
287 % if @newlist = T then \@noitemerr fi
288 % %% This command removed for some forgotten reason.
289 % \@topsepadd :=L \topsep
290 % if @noskipsec then leave vertical mode fi %% Added 11 Jun 85
292 % then \@topsepadd :=L \@topsepadd + \partopsep
293 % else \unskip \par % remove glue from end of last line
296 % then @noparitem :=L true
297 % @noparlist :=L true
298 % else @noparlist :=L false
299 % \@topsep :=L \@topsepadd
301 % \@topsep :=L \@topsep + \parskip %% Change 4 Sep 85
302 % \leftskip :=L 0pt % Restore paragraphing parameters
303 % \rightskip :=L \@rightskip
304 % \parfillskip :=L 0pt + 1fil
306 % NOTE: \@setpar called on every \list in case \par has been
307 % temporarily munged before the \list command.
308 % \@setpar{if @newlist = false then {\@@par} fi}
310 % \@outerparskip :=L \parskip
315 % \parsep := \parskip
320 % \itemindent := \parindent
321 % \@itemlabel :=L "empty" %% added 93/12/13
322 % \makelabel{LABEL} == LABEL
327 % if @inlabel = T then \indent fi
328 % if horizontal mode then \unskip \par fi
329 % if @noparlist = true
330 % else if \lastskip > 0
331 % then \@tempskipa := \lastskip
333 % \vskip \@tempskipa -\@outerparskip + \parskip
341 % \addpenalty{@endparpenalty}
342 % \addvspace{\@topsepadd}
343 % \endgroup %% ends the \begin command's \begingroup
349 % \everypar == BEGIN remove \lastbox \everypar{} END
350 % \begingroup %% to match the \end commands \endgroup
353 % \item == BEGIN if math mode then WARNING fi
356 % else @noitemarg := true
362 % if @noparitem = true
363 % then @noparitem := false
364 % % NOTE: then clause hardly every taken,
365 % % so made a macro \@donoparitem
366 % \box\@labels :=G \hbox{\hskip -\leftmargin
368 % \hskip \leftmargin }
369 % if @minipage = false then
370 % \@tempskipa := \lastskip
372 % \vskip \@tempskipa + \@outerparskip - \parskip
374 % else if @inlabel = true
375 % then \indent \par % previous item empty.
377 % if hmode then 2 \unskip's
378 % % To remove any space at end of prev.
379 % % paragraph that could cause a blank line.
383 % then if @nobreak = T % Kludge if list follows \section
384 % then \addvspace{\@outerparskip - \parskip}
385 % else \addpenalty{\@beginparpenalty}
386 % \addvspace{\@topsep}
387 % \addvspace{-\parskip} %% added 4 Sep 85
389 % else \addpenalty{\@itempenalty}
390 % \addvspace{\itemsep}
395 % \everypar{ @minipage :=G F
398 % then @inlabel :=G false
402 % %% 3 Oct 85 -- allow line break here
403 % \box\@labels :=G null
407 % if @noitemarg = true
408 % then @noitemarg := false
410 % then \refstepcounter{\@listctr}
412 % \@tempboxa :=L \hbox{\makelabel{LAB}}
413 % \box\@labels :=G \@labels \hskip \itemindent
414 % \hskip - (\labelwidth + \labelsep)
415 % if \wd \@tempboxa > \labelwidth
416 % then \box\@tempboxa
417 % else \hbox to \labelwidth {\unhbox\@tempboxa}
420 % \ignorespaces %gobble space up to text
423 % \makelabel{LABEL} == ERROR %% default to catch lonely \item
426 % \usecounter{CTR} == BEGIN @nmbrlist :=L true
428 % \setcounter{CTR}{0}
431 % DEFINE \dimen's and \count
433 % \begin{macro}{\topskip}
434 % \begin{macro}{\partopsep}
435 % \begin{macro}{\itemsep}
436 % \begin{macro}{\parsep}
437 % \begin{macro}{\@topsep}
438 % \begin{macro}{\@topsepadd}
439 % \begin{macro}{\outerparskip}
448 \newskip\@outerparskip
450 % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
452 % \begin{macro}{\leftmargin}\begin{macro}{\rightmargin}
453 % \begin{macro}{\listparindent}\begin{macro}{\itemindent}
454 % \begin{macro}{\labelwidth}\begin{macro}{\labelsep}
455 % \begin{macro}{\@totalleftmargin}
458 \newdimen\rightmargin
459 \newdimen\listparindent
464 \newdimen\@totalleftmargin \@totalleftmargin=\z@
466 % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
467 % \end{macro}\end{macro}
469 % \begin{macro}{\leftmargini}
470 % \begin{macro}{\leftmarginii}
471 % \begin{macro}{\leftmarginiii}
472 % \begin{macro}{\leftmarginiv}
473 % \begin{macro}{\leftmarginv}
474 % \begin{macro}{\leftmarginvi}
476 \newdimen\leftmargini
477 \newdimen\leftmarginii
478 \newdimen\leftmarginiii
479 \newdimen\leftmarginiv
480 \newdimen\leftmarginv
481 \newdimen\leftmarginvi
483 % \end{macro}\end{macro}\end{macro}
484 % \end{macro}\end{macro}\end{macro}
486 % \begin{macro}{\@listdepth}\begin{macro}{\@itempenalty}
487 % \begin{macro}{\@beginparpenalty}\begin{macro}{\@endparpenalty}
489 \newcount\@listdepth \@listdepth=0
490 \newcount\@itempenalty
491 \newcount\@beginparpenalty
492 \newcount\@endparpenalty
494 % \end{macro}\end{macro}\end{macro}\end{macro}
496 % \begin{macro}{\@labels}
502 % \begin{macro}{\if@inlabel}
503 % \begin{macro}{\@inlabelfalse}
504 % \begin{macro}{\@inlabeltrue}
506 \newif\if@inlabel \@inlabelfalse
508 % \end{macro}\end{macro}\end{macro}
510 % \begin{macro}{\if@newlist}
511 % \begin{macro}{\@newlistfalse}
512 % \begin{macro}{\@newlisttrue}
514 \newif\if@newlist \@newlistfalse
516 % \end{macro}\end{macro}\end{macro}
518 % \begin{macro}{\if@noparitem}
519 % \begin{macro}{\@noparitemfalse}
520 % \begin{macro}{\@noparitemtrue}
522 \newif\if@noparitem \@noparitemfalse
524 % \end{macro}\end{macro}\end{macro}
526 % \begin{macro}{\if@noparlist}
527 % \begin{macro}{\@noparlistfalse}
528 % \begin{macro}{\@noparlisttrue}
530 \newif\if@noparlist \@noparlistfalse
532 % \end{macro}\end{macro}\end{macro}
534 % \begin{macro}{\if@noitemarg}
535 % \begin{macro}{\@noitemargfalse}
536 % \begin{macro}{\@noitemargtrue}
538 \newif\if@noitemarg \@noitemargfalse
540 % \end{macro}\end{macro}\end{macro}
542 % \begin{macro}{\if@newlist}
543 % \begin{macro}{\@newlistfalse}
544 % \begin{macro}{\@newlisttrue}
546 \newif\if@nmbrlist \@nmbrlistfalse
548 % \end{macro}\end{macro}\end{macro}
550 % \begin{macro}{\list}
553 \ifnum \@listdepth >5\relax
556 \global\advance\@listdepth\@ne
561 \csname @list\romannumeral\the\@listdepth\endcsname
563 \let\makelabel\@mklab
568 \parindent\listparindent
569 \advance\linewidth -\rightmargin
570 \advance\linewidth -\leftmargin
571 \advance\@totalleftmargin \leftmargin
572 \parshape \@ne \@totalleftmargin \linewidth
577 % \begin{macro}{\par@deathcycles}
579 \newcount\par@deathcycles
583 % \begin{macro}{\@trivlist}
584 % \changes{v1.0e}{1994/12/02}{RmS: Added check for looping}
585 % \changes{v1.0p}{1996/10/31}{Added check for missing item in outer
587 % \changes{v1.0q}{1996/11/04}{Moved check for missing item: only checked
588 % when not inlabel flag is false}
589 % Because |\par| is sometimes made a no-op it is possible for a missing
590 % |\item| to produce a loop that does not fill memory and so never gets
591 % trapped by \TeX. We thus need to trap this here by seting |\par| to
592 % count the number of times a paragraph ii is called with no progress
593 % being made started.
596 \if@noskipsec \leavevmode \fi
599 \advance\@topsepadd \partopsep
607 \if@newlist \@noitemerr \fi
611 \advance\@topsep \parskip
613 \rightskip \@rightskip
614 \parfillskip \@flushglue
617 \advance\par@deathcycles \@ne
618 \ifnum \par@deathcycles >\@m
625 \global \@newlisttrue
626 \@outerparskip \parskip}
630 % \changes{0.0}{1992/03/18}{RmS: added \cs{@nmbrlistfalse}}
631 % \begin{macro}{\trivlist}
642 % We initialise |\@itemlabel| so that a \texttt{trivlist} with
643 % an |\item| not having an optional argument doesn't produce an
645 % \changes{latex2e}{1993/12/13}{Initialised \cs{@itemlabel}}
647 \let\@itemlabel\@empty
648 \def\makelabel##1{##1}}
652 % \begin{macro}{\endlist}
655 \global\advance\@listdepth\m@ne
660 % The definition of \cs{trivlist} used to be in ltspace.dtx
661 % so that other commands could be `let to it'.
662 % They now use \cs{def}.
663 % \begin{macro}{\endtrivlist}
664 % \changes{v1.2b ltspace}{1994/11/12}{Changed order of tests to make
665 % \cs{@noitemerror} correct: end of an era.}
666 % \changes{v1.0i}{1995/05/25}{Macros moved from ltspace.dtx}
667 % \changes{v1.0n}{1996/10/25}{Change \cs{indent} to \cs{leavevmode}}
668 % \changes{v1.0n}{1996/10/25}{Reset flags explicitly}
669 % \changes{v1.0o}{1996/10/26}{Correct typo}
674 \global \@inlabelfalse
678 \global \@newlistfalse
682 % We also check if we are in math mode and issue an error message
683 % if so (hoping that |\@currenvir| resolves suitably). Otherwise
684 % the usual ``perhaps a missing item'' error will get triggered
685 % later which is confusing.
686 % \changes{v1.0s}{2002/10/28}{Check for math mode (pr/3437)}
689 \@inmatherr{\end{\@currenvir}}%
693 \@tempskipa\lastskip \vskip -\lastskip
694 \advance\@tempskipa\parskip \advance\@tempskipa -\@outerparskip
705 % \begin{macro}{\@endparenv}
706 % \begin{macro}{\@doendpe}
707 % To suppress the paragraph indentation in text immediately following
708 % a paragraph-making environment, \cs{everypar} is changed to remove the
709 % space, and \cs{par} is redefined to restore \cs{everypar}. Instead of
710 % redefining \cs{par} and \cs{everypar}, \cs{@endparenv} was changed to
711 % set the @endpe switch, letting \cs{end} redefine \cs{par} and
714 % This allows paragraph-making environments to work right when called
715 % by other environments. (Changed 27 Oct 86)
718 \addpenalty\@endparpenalty\addvspace\@topsepadd\@endpetrue}
722 %<latexrelease>\IncludeInRelease{2015/01/01}{\@doendpe}{clubpenalty fix}%
723 \def\@doendpe{\@endpetrue
724 \def\par{\@restorepar
726 % If a section heading changes |\clubpenalty| to keep lines
727 % after it together then this modification is restored via the
728 % |\everypar| mechanism at the start of the next paragraph. As we
729 % destroy the contents of this token here we explicity set
730 % |\clubpenalty| back to its default.
731 % \changes{v1.0t}{2015/05/10}{Explicitly reset \cs{clubpenalty} before
732 % clearing \cs{everypar}; see also pr/0462 and pr/4065}
734 \clubpenalty\@clubpenalty
735 \everypar{}\par\@endpefalse}\everypar
738 % Use |\setbox0=\lastbox| instead of |\hskip -\parindent|
739 % so that a \cs{noindent} becomes a no-op when used before
740 % a line immediately following a list environment(23 Oct 86).
741 % \changes{v1.0k}{1995/11/07}{Enclosed \cs{setbox0} assignment by a
742 % group so that it leaves the contents of box $0$ intact.}
744 {{\setbox\z@\lastbox}%
745 \everypar{}\@endpefalse}}
746 %<latexrelease>\EndIncludeInRelease
750 %<latexrelease>\IncludeInRelease{0000/00/00}{\@doendpe}{clubpenalty fix}%
751 %<latexrelease>\def\@doendpe{\@endpetrue
752 %<latexrelease> \def\par{\@restorepar\everypar{}\par\@endpefalse}\everypar
753 %<latexrelease> {{\setbox\z@\lastbox}\everypar{}\@endpefalse}}
754 %<latexrelease>\EndIncludeInRelease
760 % \begin{macro}{\if@endpe}
761 % \begin{macro}{\@endpefalse}
762 % \begin{macro}{\@endpeltrue}
767 % \end{macro}\end{macro}\end{macro}
770 % \begin{macro}{\@mklab}
772 \def\@mklab#1{\hfil #1}
776 % \changes{LaTeX2.09}{1992/09/18}
777 % {(RmS) Added warning if \cs{item} is used in math mode}
778 % \changes{v1.0c}{1994/04/28}
779 % {Replaced \cs{@ltxnomath} by \cs{@inmatherr}}
780 % \changes{v1.0d}{1994/05/03}
781 % {Removed superfluous braces}
782 % \begin{macro}{\item}
786 \@ifnextchar [\@item{\@noitemargtrue \@item[\@itemlabel]}}
789 % \begin{macro}{\@donoparitem}
793 \global\setbox\@labels\hbox{\hskip -\leftmargin
799 \advance\@tempskipa\@outerparskip
800 \advance\@tempskipa -\parskip
806 % \begin{macro}{\@item}
807 % \changes{v1.0l}{1996/07/26}{Remove unecessary \cs{global} before
824 \addpenalty\@beginparpenalty
826 \addvspace{-\parskip}%
829 \addpenalty\@itempenalty
836 \global\@newlistfalse
838 % This |\if@inlabel| check is needed in case an item starts of
839 % inside a group so that |\everypar| does not become empty
840 % outside that group.
841 % \@nobreakfalse, etc etc.
844 \global\@inlabelfalse
846 % The paragraph indent is now removed by using |\setbox...| since
847 % this makes |\noindent| a no-op here, as it should be. Thus the
848 % following comment is redundant but is left here for the sake of
850 % this next command was changed from an hskip to a kern to avoid
851 % a break point after the parindent box: the skip could cause a
852 % line-break if a very long label occurs in raggedright setting.
853 % \changes{v1.0d}{1994/05/03}{\cs{hskip} changed to \cs{kern}}
854 % \changes{v1.0m}{1996/10/23}{\cs{kern...} changed to \cs{setbox...}}
855 % \changes{v1.0r}{1997/02/21}
856 % {\cs{ifvoid} check added for \cs{noindent}. latex/2414}
857 % If |\noindent| was used after |\item| want to cancel the |\itemindent|
858 % skip. This case can be detected as the indentation box will be void.
871 % This code is intended to prevent a page break after the first
872 % line of an item that comes immediately after a section title. It
873 % may be sensible to always forbid a page break after one line of
874 % an item? As with all such settings of |\clubpenalty| it is local
875 % so will have no effect if the item starts in a group.
877 % Only resetting |\@nobreak| when it is true is now
878 % essential since now it is sometimes set locally.
879 % \changes{v1.0m}{1996/10/23}{Added setting of \cs{clubpenalty} and
880 % set \cs{@nobreakfalse} only when necessary}
886 \clubpenalty \@clubpenalty
890 % \changes{v1.0l}{1996/07/26}{Remove unecessary \cs{global} before
892 % \changes{v1.0m}{1996/10/23}{\cs{@nobreak...} moved into the
893 % \cs{everypar} and not executed unconditionally, see above}
899 % \changes{v1.0g}{1995/05/17}{Removed surplus braces}
901 \refstepcounter\@listctr
905 % We use |\sbox| to support colour commands.
906 % \changes{LaTeX2e}{1993/12/08}{use \cs{sbox} to support colour}
908 \sbox\@tempboxa{\makelabel{#1}}%
909 \global\setbox\@labels\hbox{%
914 \ifdim \wd\@tempboxa >\labelwidth
917 % \changes{LaTeX2.09}{1991/11/22}
918 % {(RmS) Changed second call to \cs{makelabel} to
919 % \cs{unhbox}\cs{@tempboxa}.
920 % Avoids problems with side effects in \cs{makelabel} and is
924 \hbox to\labelwidth {\unhbox\@tempboxa}%
931 % \begin{macro}{\makelabel}
932 % \changes{LaTeX2.09}{1991/11/04}
933 % {(RmS) added default definition for \cs{makelabel},
934 % to produce an error message.}
937 \@latex@error{Lonely \string\item--perhaps a missing
938 list environment}\@ehc}
942 % \begin{macro}{\@nbitem}
943 % \changes{v1.0g}{1995/05/17}{Removed surplus braces}
946 \@tempskipa\@outerparskip
947 \advance\@tempskipa -\parskip
948 \addvspace\@tempskipa}
952 % \begin{macro}{\usecounter}
954 \def\usecounter#1{\@nmbrlisttrue\def\@listctr{#1}\setcounter{#1}\z@}
959 % \subsection{Itemize and Enumerate}
961 % Enumeration is done with four counters: |enumi|, |enumii|, |enumiii|
962 % and |enumiv|, where |enum|N controls the numbering of the Nth level
963 % enumeration. The label is generated by the commands
964 % \cs{labelenumi} \ldots{} \cs{labelenumiv}, which should be defined
965 % by the document style.
966 % Note that \cs{p@enum}N\cs{theenum}N defines the output
967 % of a \cs{ref} command. A typical definition might be:
969 % \def\theenumii{\alph{enumii}}
970 % \def\p@enumii{\theenumi}
971 % \def\labelenumii{(\theenumii)}
973 % which will print the labels as `(a)', `(b)', \ldots
974 % and print a \cs{ref} as `3a'.
976 % The item numbers are moved to the right of the label box, so they are
977 % always a distance of \cs{labelsep} from the item.
979 % \cs{@enumdepth} holds the current enumeration nesting depth.
981 % Itemization is controlled by four commands: \cs{labelitemi},
983 % \cs{labelitemiii}, and \cs{labelitemiv}.
984 % To cause the second-level list to be
985 % bulleted, you just define \cs{labelitemii}
986 % to be $\bullet$. \cs{@itemspacing}
987 % and \cs{@itemdepth} are the analogs of \cs{@enumspacing} and
990 % \begin{oldcomments}
994 % then errormessage: ``Too deeply nested''.
995 % else \@enumdepth :=L \@enumdepth + 1
996 % \@enumctr :=L eval(enum@\romannumeral\the\@enumdepth)
997 % \list{\label(\@enumctr)}
998 % {\usecounter{\@enumctr}
999 % \makelabel{LABEL} == \hss \llap{LABEL}}
1003 % \endenumerate == \endlist
1006 % \begin{macro}{\@enumdepth}
1008 \newcount\@enumdepth \@enumdepth = 0
1012 % \begin{macro}{\c@enumi}
1013 % \begin{macro}{\c@enumii}
1014 % \begin{macro}{\c@enumii}
1015 % \begin{macro}{\c@enumiv}
1017 \@definecounter{enumi}
1018 \@definecounter{enumii}
1019 \@definecounter{enumiii}
1020 \@definecounter{enumiv}
1027 % \begin{environment}{enumerate}
1028 % \changes{v1.0g}{1995/05/17}{Use \cs{thr@@} and remove surplus braces}
1031 \ifnum \@enumdepth >\thr@@\@toodeep\else
1032 \advance\@enumdepth\@ne
1033 \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
1036 % \changes{v1.0j}{1995/07/09}{Use \cs{expandafter}}
1040 \csname label\@enumctr\endcsname
1041 {\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
1046 \let\endenumerate =\endlist
1051 % \begin{oldcomments}
1054 % if \@itemdepth > 3
1055 % then errormessage: 'Too deeply nested'.
1056 % else \@itemdepth :=L \@itemdepth + 1
1057 % \@itemitem == eval(labelitem\romannumeral\the\@itemdepth)
1058 % \list{\@nameuse{\@itemitem}}
1059 % {\makelabel{LABEL} == \hss \llap{LABEL}}
1063 % \enditemize == \endlist
1067 % \begin{macro}{\@itemdepth}
1069 \newcount\@itemdepth \@itemdepth = 0
1073 % \begin{environment}{itemize}
1074 % \changes{v1.0g}{1995/05/17}{Use \cs{thr@@}}
1077 \ifnum \@itemdepth >\thr@@\@toodeep\else
1078 \advance\@itemdepth\@ne
1079 \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
1082 % \changes{v1.0j}{1995/07/09}{Use \cs{expandafter}}
1086 \csname\@itemitem\endcsname
1087 {\def\makelabel##1{\hss\llap{##1}}}%
1092 \let\enditemize =\endlist