| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 1993-2025 |
| 4 |
% The LaTeX Project and any individual authors listed elsewhere |
| 5 |
% in this file. |
| 6 |
% |
| 7 |
% This file is part of the LaTeX base system. |
| 8 |
% ------------------------------------------- |
| 9 |
% |
| 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 |
% https://www.latex-project.org/lppl.txt |
| 15 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 16 |
% version 2008 or later. |
| 17 |
% |
| 18 |
% This file has the LPPL maintenance status "maintained". |
| 19 |
% |
| 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 |
| 22 |
% information. |
| 23 |
% |
| 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. |
| 27 |
% |
| 28 |
% \fi |
| 29 |
% \iffalse |
| 30 |
%%% From File: ltlists.dtx |
| 31 |
%<*driver> |
| 32 |
% \fi |
| 33 |
\ProvidesFile{ltlists.dtx} |
| 34 |
[2025/05/22 v1.0v LaTeX Kernel (List Environments)] |
| 35 |
% \iffalse |
| 36 |
\documentclass{ltxdoc} |
| 37 |
\GetFileInfo{ltlists.dtx} |
| 38 |
\title{\filename} |
| 39 |
\date{\filedate} |
| 40 |
\author{% |
| 41 |
Johannes Braams\and |
| 42 |
David Carlisle\and |
| 43 |
Alan Jeffrey\and |
| 44 |
Leslie Lamport\and |
| 45 |
Frank Mittelbach\and |
| 46 |
Tobias Oetiker\thanks{Tobi has converted the documentation to |
| 47 |
doc.sty standard}\and |
| 48 |
Chris Rowley\and |
| 49 |
Rainer Sch\"opf} |
| 50 |
|
| 51 |
\begin{document} |
| 52 |
\MaintainedByLaTeXTeam{latex} |
| 53 |
\maketitle |
| 54 |
\DocInput{\filename} |
| 55 |
\end{document} |
| 56 |
%</driver> |
| 57 |
% \fi |
| 58 |
% |
| 59 |
% |
| 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} |
| 63 |
% |
| 64 |
% \section{List, and related environments} |
| 65 |
% |
| 66 |
% The generic commands for creating an indented environment -- |
| 67 |
% |enumerate|, |itemize|, |quote|, etc -- are: |
| 68 |
% \begin{quote} |
| 69 |
% |\list|\marg{LABEL}\marg{COMMANDS} ... |\endlist| |
| 70 |
% \end{quote} |
| 71 |
% which can be invoked by the user as the list environment. The LABEL |
| 72 |
% argument specifies item labeling. COMMANDS contains commands for |
| 73 |
% changing the horizontal and vertical spacing parameters. |
| 74 |
% |
| 75 |
% Each item of the environment is begun by the command |
| 76 |
% |\item[|ITEMLABEL|]| |
| 77 |
% which produces an item labeled by ITEMLABEL. If the argument is |
| 78 |
% missing, then the LABEL argument of the |\list| command is used as the |
| 79 |
% item label. |
| 80 |
% |
| 81 |
% The label is formed by putting |\makelabel|\marg{ITEMLABEL} in an hbox |
| 82 |
% whose width is either its natural width or else |\labelwidth|, |
| 83 |
% whichever is larger. The |\list| command defines |\makelabel| to have |
| 84 |
% the default definition: |
| 85 |
% \begin{quote} |
| 86 |
% |\makelabel|\marg{ARG} == BEGIN |\hfil| ARG END |
| 87 |
% \end{quote} |
| 88 |
% which, for a label of width less than |\labelwidth|, puts the label |
| 89 |
% flushright, |\labelsep| to the left of the item's text. However, |
| 90 |
% |\makelabel| can be |\let| to another command by the |\list|'s |
| 91 |
% COMMANDS argument. |
| 92 |
% |
| 93 |
% A |\usecounter|\marg{foo} command in the second argument causes the |
| 94 |
% counter \emph{foo} to be initialized to zero, and stepped by every |
| 95 |
% |\item| command without an argument. (|\label| commands within the |
| 96 |
% list refer to this counter.) |
| 97 |
% |
| 98 |
% When you leave a list environment, returning either to an enclosing |
| 99 |
% list or normal text mode, LaTeX begins a new paragraph if and only if |
| 100 |
% you leave a blank line after the |\end| command. This is accomplished |
| 101 |
% by the |\@endparenv| command. |
| 102 |
% |
| 103 |
% Blank lines are ignored every other reasonable place--i.e.: |
| 104 |
% \begin{itemize} |
| 105 |
% \item Between the |\begin{list}| and the first |\item|, |
| 106 |
% \item Between the |\item| and the text of that item. |
| 107 |
% \item Between the end of the last item and the |\end{list}|. |
| 108 |
% \end{itemize} |
| 109 |
% |
| 110 |
% For an environment like quotation, in which items are not labeled, |
| 111 |
% the entire environment is a single item. It is defined by |
| 112 |
% letting |\quotation| == |\list{}{...}\item\relax|. (Note the |
| 113 |
% |\relax|, there in case the first character in the environment is a |
| 114 |
% '['.) The spacing parameters provide a great deal of flexibility in |
| 115 |
% designing the format, including the ability to let the indentation of |
| 116 |
% the first paragraph be different from that of the subsequent ones. |
| 117 |
% |
| 118 |
% The trivlist environment is equivalent to a list environment |
| 119 |
% whose second argument sets the following parameter values: |
| 120 |
% \begin{description} |
| 121 |
% \item[\cs{leftmargin} = 0:] causes no indentation of left margin |
| 122 |
% \item[\cs{labelwidth} = 0:] see below for precise effect this has. |
| 123 |
% \item[\cs{itemindent} = 0:] with a null label, makes first paragraph |
| 124 |
% have no indentation. Succeeding paragraphs have |\parindent| |
| 125 |
% indentation. To give first paragraph same indentation, set |
| 126 |
% |\itemindent| = |\parindent| before the |\item[]|. |
| 127 |
% \end{description} |
| 128 |
% |
| 129 |
% Every |\item| in a trivlist environment must have an argument---in |
| 130 |
% many cases, this will be the null argument (|\item[]|). The trivlist |
| 131 |
% environment is mainly used for paragraphing environments, like |
| 132 |
% verbatim, in which there is no margin change. It provides the same |
| 133 |
% vertical spacing as the list environment, and works reasonably well |
| 134 |
% when it occurs immediately after an |\item| command in an enclosing |
| 135 |
% list. |
| 136 |
% |
| 137 |
% \MaybeStop{} |
| 138 |
% |
| 139 |
% |
| 140 |
% \changes{v1.0a}{1994/03/07}{Initial version, split from latex.dtx} |
| 141 |
% \changes{v1.0a}{1994/03/07}{Long lines wrapped to 72 columns} |
| 142 |
% |
| 143 |
% |
| 144 |
% \subsection{List and Trivlist} |
| 145 |
% |
| 146 |
% |
| 147 |
% The following variables are used inside a list environment: |
| 148 |
% \begin{description} |
| 149 |
% \item[\cs{@totalleftmargin}] The distance that the prevailing left |
| 150 |
% margin is indented from the outermost left margin, |
| 151 |
% \item[\cs{linewidth}] The width of the current line. Must be |
| 152 |
% initialized to |\hsize|. |
| 153 |
% \item[\cs{@listdepth}] A count for holding current list nesting depth. |
| 154 |
% \item[\cs{makelabel}] A macro with a single argument, used to |
| 155 |
% generate the label from the argument (given or implied) |
| 156 |
% of the |\item| command. Initialized to |\@mklab| by the |\list| |
| 157 |
% command. This command must produce some stretch---i.e., an |
| 158 |
% |\hfil|. |
| 159 |
% \item[\texttt{@inlabel}] A switch that is false except between the time |
| 160 |
% an |\item| is encountered and the time that \TeX{} |
| 161 |
% actually enters horizontal mode. Should be tested by commands |
| 162 |
% that can be messed up by the list environment's use of |\everypar|. |
| 163 |
% \item[\cs{box}\cs{@labels}] When |@inlabel = true|, it holds the labels |
| 164 |
% to be put out by |\everypar|. |
| 165 |
% \item[\texttt{@noparitem}] A switch set by |\list| when |
| 166 |
% |@inlabel = true|. |
| 167 |
% Handles the case of a |\list| being the first thing in an item. |
| 168 |
% \item[\texttt{@noparlist}] A switch set true for a list that begins an |
| 169 |
% item. No |\topsep| space is added before or after |\item|'s such a |
| 170 |
% list. |
| 171 |
% \item[\texttt{@newlist}] Set true by |\list|, set false by the first |
| 172 |
% text (by |\everypar|). |
| 173 |
% \item[\texttt{@noitemarg}] Set true when executing an |\item| with no |
| 174 |
% explicit argument. Used to save space. To save time, make two |
| 175 |
% separate |\@item| commands. |
| 176 |
% \item[\texttt{@nmbrlist}] Set true by |\usecounter| command, causes |
| 177 |
% list to be numbered. |
| 178 |
% \item[\cs{@listctr}] |\def|'ed by |\usecounter| to name of counter. |
| 179 |
% \item[\texttt{@noskipsec}] A switch set true by a sectioning command when |
| 180 |
% it is creating an in-text heading with |\everypar|. |
| 181 |
% \end{description} |
| 182 |
% |
| 183 |
% Throughout a list environment, |\hsize| is the width of the current |
| 184 |
% line, measured from the outermost left margin to the outermost right |
| 185 |
% margin. Environments like tabbing should use |\linewidth| instead of |
| 186 |
% |\hsize|. |
| 187 |
% |
| 188 |
% Here are the parameters of a list that can be set by commands in |
| 189 |
% the |\list|'s COMMANDS argument. These parameters are all \TeX{} |
| 190 |
% skips or dimensions (defined by |\newskip| or |\newdimen|), so the |
| 191 |
% usual \TeX\ or \LaTeX\ commands can be used to set them. The |
| 192 |
% commands will be executed in vmode if and only if the |\list| was |
| 193 |
% preceded by a |\par| (or something like an |\end{list}|), so the |
| 194 |
% spacing parameters can be set according to whether the list is |
| 195 |
% inside a paragraph or is its own paragraph. |
| 196 |
% |
| 197 |
% |
| 198 |
% \subsection{Vertical Spacing (skips)} |
| 199 |
% \begin{description} |
| 200 |
% \item[\cs{topsep}:] Space between first item and preceding paragraph. |
| 201 |
% \item[\cs{partopsep}:] Extra space added to \cs{topsep} when |
| 202 |
% environment starts a new paragraph (is called in vmode). |
| 203 |
% \item[\cs{itemsep}:] Space between successive items. |
| 204 |
% \item[\cs{parsep}:] Space between paragraphs within an item -- the |
| 205 |
% \cs{parskip} for this environment. |
| 206 |
% \end{description} |
| 207 |
% |
| 208 |
% \subsection{Penalties} |
| 209 |
% \begin{description} |
| 210 |
% |
| 211 |
% \item[\cs{@beginparpenalty}:] put at the beginning of a list |
| 212 |
% \item[\cs{@endparpenalty}:] put at end of list |
| 213 |
% \item[\cs{@itempenalty}:] put between items. |
| 214 |
% \end{description} |
| 215 |
% |
| 216 |
% \subsection{Horizontal Spacing (dimens)} |
| 217 |
% \begin{description} |
| 218 |
% \item[\cs{leftmargin}:] space between left margin of enclosing |
| 219 |
% environment (or of page if top level list) and left margin of |
| 220 |
% this list. Must be nonnegative. |
| 221 |
% \item[\cs{rightmargin}:] analogous. |
| 222 |
% \item[\cs{listparindent}:] extra indentation at beginning of every |
| 223 |
% paragraph of a list except the one started by the \cs{item} |
| 224 |
% command. May be negative! Usually, labeled |
| 225 |
% lists have \cs{listparindent} equal to zero. |
| 226 |
% \item[\cs{itemindent}:] extra indentation added right BEFORE an item |
| 227 |
% label. |
| 228 |
% \item[\cs{labelwidth}:] nominal width of box that contains the label. |
| 229 |
% If the natural width of the |
| 230 |
% label $\leq$ \cs{labelwidth}, |
| 231 |
% then the label is flushed right inside a box |
| 232 |
% of width \cs{labelwidth} (with an \cs{hfil}). |
| 233 |
% Otherwise, |
| 234 |
% a box of the natural width is employed, which |
| 235 |
% causes an indentation of the text on that line. |
| 236 |
% \item[\cs{labelsep}:] space between end of label box and text of |
| 237 |
% first item. |
| 238 |
% \end{description} |
| 239 |
% \subsection{Default Values} |
| 240 |
% Defaults for the list environment are set as follows. |
| 241 |
% First, \cs{rightmargin}, \cs{listparindent} and \cs{itemindent} |
| 242 |
% are set |
| 243 |
% to 0pt. Then, one of the commands |
| 244 |
% \cs{@listi}, \cs{@listii}, ... , \cs{@listvi} |
| 245 |
% is called, depending upon the current level of the list. |
| 246 |
% The \cs{@list} \ldots commands should be defined by the document |
| 247 |
% style. A convention that the document style should follow is |
| 248 |
% to set \cs{leftmargin} to |
| 249 |
% \cs{leftmargini},\ldots, \cs{leftmarginvi} for |
| 250 |
% the appropriate level. Items that aren't changed may be left |
| 251 |
% alone, but everything that could possibly be changed must be |
| 252 |
% reset. |
| 253 |
% \begin{oldcomments} |
| 254 |
% \list{LABEL}{COMMANDS} == |
| 255 |
% BEGIN |
| 256 |
% if \@listdepth > 5 |
| 257 |
% then LaTeX error: 'Too deeply nested' |
| 258 |
% else \@listdepth :=G \@listdepth + 1 |
| 259 |
% fi |
| 260 |
% \rightmargin := 0pt |
| 261 |
% \listparindent := 0pt |
| 262 |
% \itemindent := 0pt |
| 263 |
% \eval(@list \romannumeral\the\@listdepth) %% Set default values: |
| 264 |
% \@itemlabel :=L LABEL |
| 265 |
% \makelabel == \@mklab |
| 266 |
% @nmbrlist :=L false |
| 267 |
% COMMANDS |
| 268 |
% |
| 269 |
% \@trivlist % commands common to \list and \trivlist |
| 270 |
% |
| 271 |
% \parskip :=L \parsep |
| 272 |
% \parindent :=L \listparindent |
| 273 |
% \linewidth :=L \linewidth - \rightmargin -\leftmargin |
| 274 |
% \@totalleftmargin :=L \@totalleftmargin + \leftmargin |
| 275 |
% \parshape 1 \@totalleftmargin \linewidth |
| 276 |
% \ignorespaces % gobble space up to \item |
| 277 |
% END |
| 278 |
% |
| 279 |
% \endlist == BEGIN \@listdepth :=G \@listdepth -1 |
| 280 |
% \endtrivlist |
| 281 |
% END |
| 282 |
% |
| 283 |
% \@trivlist == |
| 284 |
% BEGIN |
| 285 |
% if @newlist = T then \@noitemerr fi |
| 286 |
% %% This command removed for some forgotten reason. |
| 287 |
% \@topsepadd :=L \topsep |
| 288 |
% if @noskipsec then leave vertical mode fi %% Added 11 Jun 85 |
| 289 |
% if vertical mode |
| 290 |
% then \@topsepadd :=L \@topsepadd + \partopsep |
| 291 |
% else \unskip \par % remove glue from end of last line |
| 292 |
% fi |
| 293 |
% if @inlabel = true |
| 294 |
% then @noparitem :=L true |
| 295 |
% @noparlist :=L true |
| 296 |
% else @noparlist :=L false |
| 297 |
% \@topsep :=L \@topsepadd |
| 298 |
% fi |
| 299 |
% \@topsep :=L \@topsep + \parskip %% Change 4 Sep 85 |
| 300 |
% \leftskip :=L 0pt % Restore paragraphing parameters |
| 301 |
% \rightskip :=L \@rightskip |
| 302 |
% \parfillskip :=L 0pt + 1fil |
| 303 |
% |
| 304 |
% NOTE: \@setpar called on every \list in case \par has been |
| 305 |
% temporarily munged before the \list command. |
| 306 |
% \@setpar{if @newlist = false then {\@@par} fi} |
| 307 |
% \@newlist :=G T |
| 308 |
% \@outerparskip :=L \parskip |
| 309 |
% END |
| 310 |
% |
| 311 |
% \trivlist == |
| 312 |
% BEGIN |
| 313 |
% \parsep := \parskip |
| 314 |
% @nmbrlist := F |
| 315 |
% \@trivlist |
| 316 |
% \labelwidth := 0 |
| 317 |
% \leftmargin := 0 |
| 318 |
% \itemindent := \parindent |
| 319 |
% \@itemlabel :=L "empty" %% added 93/12/13 |
| 320 |
% \makelabel{LABEL} == LABEL |
| 321 |
% END |
| 322 |
% |
| 323 |
% \endtrivlist == |
| 324 |
% BEGIN |
| 325 |
% if @inlabel = T then \indent fi |
| 326 |
% if horizontal mode then \unskip \par fi |
| 327 |
% if @noparlist = true |
| 328 |
% else if \lastskip > 0 |
| 329 |
% then \@tempskipa := \lastskip |
| 330 |
% \vskip - \lastskip |
| 331 |
% \vskip \@tempskipa -\@outerparskip + \parskip |
| 332 |
% fi |
| 333 |
% \@endparenv |
| 334 |
% fi |
| 335 |
% END |
| 336 |
% |
| 337 |
% \@endparenv == |
| 338 |
% BEGIN |
| 339 |
% \addpenalty{@endparpenalty} |
| 340 |
% \addvspace{\@topsepadd} |
| 341 |
% \endgroup %% ends the \begin command's \begingroup |
| 342 |
% \par == BEGIN |
| 343 |
% \@restorepar |
| 344 |
% \everypar{} |
| 345 |
% \par |
| 346 |
% END |
| 347 |
% \everypar == BEGIN remove \lastbox \everypar{} END |
| 348 |
% \begingroup %% to match the \end commands \endgroup |
| 349 |
% END |
| 350 |
% |
| 351 |
% \item == BEGIN if math mode then WARNING fi |
| 352 |
% if next char = [ |
| 353 |
% then \@item |
| 354 |
% else @noitemarg := true |
| 355 |
% \@item[@itemlabel] |
| 356 |
% END |
| 357 |
% |
| 358 |
% \@item[LAB] == |
| 359 |
% BEGIN |
| 360 |
% if @noparitem = true |
| 361 |
% then @noparitem := false |
| 362 |
% % NOTE: then clause hardly every taken, |
| 363 |
% % so made a macro \@donoparitem |
| 364 |
% \box\@labels :=G \hbox{\hskip -\leftmargin |
| 365 |
% \box\@labels |
| 366 |
% \hskip \leftmargin } |
| 367 |
% if @minipage = false then |
| 368 |
% \@tempskipa := \lastskip |
| 369 |
% \vskip -\lastskip |
| 370 |
% \vskip \@tempskipa + \@outerparskip - \parskip |
| 371 |
% fi |
| 372 |
% else if @inlabel = true |
| 373 |
% then \indent \par % previous item empty. |
| 374 |
% fi |
| 375 |
% if hmode then 2 \unskip's |
| 376 |
% % To remove any space at end of prev. |
| 377 |
% % paragraph that could cause a blank line. |
| 378 |
% \par |
| 379 |
% fi |
| 380 |
% if @newlist = T |
| 381 |
% then if @nobreak = T % Kludge if list follows \section |
| 382 |
% then \addvspace{\@outerparskip - \parskip} |
| 383 |
% else \addpenalty{\@beginparpenalty} |
| 384 |
% \addvspace{\@topsep} |
| 385 |
% \addvspace{-\parskip} %% added 4 Sep 85 |
| 386 |
% fi |
| 387 |
% else \addpenalty{\@itempenalty} |
| 388 |
% \addvspace{\itemsep} |
| 389 |
% fi |
| 390 |
% @inlabel :=G true |
| 391 |
% fi |
| 392 |
% |
| 393 |
% \everypar{ @minipage :=G F |
| 394 |
% @newlist :=G F |
| 395 |
% if @inlabel = true |
| 396 |
% then @inlabel :=G false |
| 397 |
% \hskip -\parindent |
| 398 |
% \box\@labels |
| 399 |
% \penalty 0 |
| 400 |
% %% 3 Oct 85 -- allow line break here |
| 401 |
% \box\@labels :=G null |
| 402 |
% fi |
| 403 |
% \everypar{} } |
| 404 |
% @nobreak :=G false |
| 405 |
% if @noitemarg = true |
| 406 |
% then @noitemarg := false |
| 407 |
% if @nmbrlist |
| 408 |
% then \refstepcounter{\@listctr} |
| 409 |
% fi fi |
| 410 |
% \@tempboxa :=L \hbox{\makelabel{LAB}} |
| 411 |
% \box\@labels :=G \@labels \hskip \itemindent |
| 412 |
% \hskip - (\labelwidth + \labelsep) |
| 413 |
% if \wd \@tempboxa > \labelwidth |
| 414 |
% then \box\@tempboxa |
| 415 |
% else \hbox to \labelwidth {\unhbox\@tempboxa} |
| 416 |
% fi |
| 417 |
% \hskip\labelsep |
| 418 |
% \ignorespaces %gobble space up to text |
| 419 |
% END |
| 420 |
% |
| 421 |
% \makelabel{LABEL} == ERROR %% default to catch lonely \item |
| 422 |
% |
| 423 |
% |
| 424 |
% \usecounter{CTR} == BEGIN @nmbrlist :=L true |
| 425 |
% \@listctr == CTR |
| 426 |
% \setcounter{CTR}{0} |
| 427 |
% END |
| 428 |
% |
| 429 |
% DEFINE \dimen's and \count |
| 430 |
% \end{oldcomments} |
| 431 |
% \begin{macro}{\topsep} |
| 432 |
% \begin{macro}{\partopsep} |
| 433 |
% \begin{macro}{\itemsep} |
| 434 |
% \begin{macro}{\parsep} |
| 435 |
% \begin{macro}{\@topsep} |
| 436 |
% \begin{macro}{\@topsepadd} |
| 437 |
% \begin{macro}{\@outerparskip} |
| 438 |
% \begin{macrocode} |
| 439 |
%<*2ekernel> |
| 440 |
\newskip\topsep |
| 441 |
\newskip\partopsep |
| 442 |
\newskip\itemsep |
| 443 |
\newskip\parsep |
| 444 |
\newskip\@topsep |
| 445 |
\newskip\@topsepadd |
| 446 |
\newskip\@outerparskip |
| 447 |
% \end{macrocode} |
| 448 |
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} |
| 449 |
% \end{macro} |
| 450 |
% \begin{macro}{\leftmargin}\begin{macro}{\rightmargin} |
| 451 |
% \begin{macro}{\listparindent}\begin{macro}{\itemindent} |
| 452 |
% \begin{macro}{\labelwidth}\begin{macro}{\labelsep} |
| 453 |
% \begin{macro}{\linewidth} |
| 454 |
% \begin{macro}{\@totalleftmargin} |
| 455 |
% \begin{macrocode} |
| 456 |
\newdimen\leftmargin |
| 457 |
\newdimen\rightmargin |
| 458 |
\newdimen\listparindent |
| 459 |
\newdimen\itemindent |
| 460 |
\newdimen\labelwidth |
| 461 |
\newdimen\labelsep |
| 462 |
\newdimen\linewidth |
| 463 |
\newdimen\@totalleftmargin \@totalleftmargin=\z@ |
| 464 |
% \end{macrocode} |
| 465 |
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} |
| 466 |
% \end{macro}\end{macro}\end{macro} |
| 467 |
% |
| 468 |
% \begin{macro}{\leftmargini} |
| 469 |
% \begin{macro}{\leftmarginii} |
| 470 |
% \begin{macro}{\leftmarginiii} |
| 471 |
% \begin{macro}{\leftmarginiv} |
| 472 |
% \begin{macro}{\leftmarginv} |
| 473 |
% \begin{macro}{\leftmarginvi} |
| 474 |
% \begin{macrocode} |
| 475 |
\newdimen\leftmargini |
| 476 |
\newdimen\leftmarginii |
| 477 |
\newdimen\leftmarginiii |
| 478 |
\newdimen\leftmarginiv |
| 479 |
\newdimen\leftmarginv |
| 480 |
\newdimen\leftmarginvi |
| 481 |
% \end{macrocode} |
| 482 |
% \end{macro}\end{macro}\end{macro} |
| 483 |
% \end{macro}\end{macro}\end{macro} |
| 484 |
% |
| 485 |
% \begin{macro}{\@listdepth}\begin{macro}{\@itempenalty} |
| 486 |
% \begin{macro}{\@beginparpenalty}\begin{macro}{\@endparpenalty} |
| 487 |
% \begin{macrocode} |
| 488 |
\newcount\@listdepth \@listdepth=0 |
| 489 |
\newcount\@itempenalty |
| 490 |
\newcount\@beginparpenalty |
| 491 |
\newcount\@endparpenalty |
| 492 |
% \end{macrocode} |
| 493 |
% \end{macro}\end{macro}\end{macro}\end{macro} |
| 494 |
% |
| 495 |
% \begin{macro}{\@labels} |
| 496 |
% \begin{macrocode} |
| 497 |
\newbox\@labels |
| 498 |
% \end{macrocode} |
| 499 |
% \end{macro} |
| 500 |
% |
| 501 |
% \begin{macro}{\if@inlabel} |
| 502 |
% \begin{macro}{\@inlabelfalse} |
| 503 |
% \begin{macro}{\@inlabeltrue} |
| 504 |
% \begin{macrocode} |
| 505 |
\newif\if@inlabel \@inlabelfalse |
| 506 |
% \end{macrocode} |
| 507 |
% \end{macro}\end{macro}\end{macro} |
| 508 |
% |
| 509 |
% \begin{macro}{\if@newlist} |
| 510 |
% \begin{macro}{\@newlistfalse} |
| 511 |
% \begin{macro}{\@newlisttrue} |
| 512 |
% \begin{macrocode} |
| 513 |
\newif\if@newlist \@newlistfalse |
| 514 |
% \end{macrocode} |
| 515 |
% \end{macro}\end{macro}\end{macro} |
| 516 |
% |
| 517 |
% \begin{macro}{\if@noparitem} |
| 518 |
% \begin{macro}{\@noparitemfalse} |
| 519 |
% \begin{macro}{\@noparitemtrue} |
| 520 |
% \begin{macrocode} |
| 521 |
\newif\if@noparitem \@noparitemfalse |
| 522 |
% \end{macrocode} |
| 523 |
% \end{macro}\end{macro}\end{macro} |
| 524 |
% |
| 525 |
% \begin{macro}{\if@noparlist} |
| 526 |
% \begin{macro}{\@noparlistfalse} |
| 527 |
% \begin{macro}{\@noparlisttrue} |
| 528 |
% \begin{macrocode} |
| 529 |
\newif\if@noparlist \@noparlistfalse |
| 530 |
% \end{macrocode} |
| 531 |
% \end{macro}\end{macro}\end{macro} |
| 532 |
% |
| 533 |
% \begin{macro}{\if@noitemarg} |
| 534 |
% \begin{macro}{\@noitemargfalse} |
| 535 |
% \begin{macro}{\@noitemargtrue} |
| 536 |
% \begin{macrocode} |
| 537 |
\newif\if@noitemarg \@noitemargfalse |
| 538 |
% \end{macrocode} |
| 539 |
% \end{macro}\end{macro}\end{macro} |
| 540 |
% |
| 541 |
% \begin{macro}{\if@newlist} |
| 542 |
% \begin{macro}{\@newlistfalse} |
| 543 |
% \begin{macro}{\@newlisttrue} |
| 544 |
% \begin{macrocode} |
| 545 |
\newif\if@nmbrlist \@nmbrlistfalse |
| 546 |
% \end{macrocode} |
| 547 |
% \end{macro}\end{macro}\end{macro} |
| 548 |
% |
| 549 |
% \begin{environment}{list} |
| 550 |
% \begin{macro}{\list} |
| 551 |
% \begin{macrocode} |
| 552 |
\def\list#1#2{% |
| 553 |
\ifnum \@listdepth >5\relax |
| 554 |
\@toodeep |
| 555 |
\else |
| 556 |
\global\advance\@listdepth\@ne |
| 557 |
\fi |
| 558 |
\rightmargin\z@ |
| 559 |
\listparindent\z@ |
| 560 |
\itemindent\z@ |
| 561 |
\csname @list\romannumeral\the\@listdepth\endcsname |
| 562 |
\def\@itemlabel{#1}% |
| 563 |
\let\makelabel\@mklab |
| 564 |
\@nmbrlistfalse |
| 565 |
#2\relax |
| 566 |
\@trivlist |
| 567 |
\parskip\parsep |
| 568 |
\parindent\listparindent |
| 569 |
\advance\linewidth -\rightmargin |
| 570 |
\advance\linewidth -\leftmargin |
| 571 |
\advance\@totalleftmargin \leftmargin |
| 572 |
\parshape \@ne \@totalleftmargin \linewidth |
| 573 |
\ignorespaces} |
| 574 |
% \end{macrocode} |
| 575 |
% \end{macro} |
| 576 |
% \end{environment} |
| 577 |
% |
| 578 |
% \begin{macro}{\par@deathcycles} |
| 579 |
% \begin{macrocode} |
| 580 |
\newcount\par@deathcycles |
| 581 |
% \end{macrocode} |
| 582 |
% \end{macro} |
| 583 |
% |
| 584 |
% \begin{macro}{\@trivlist} |
| 585 |
% \changes{v1.0e}{1994/12/02}{RmS: Added check for looping} |
| 586 |
% \changes{v1.0p}{1996/10/31}{Added check for missing item in outer |
| 587 |
% list} |
| 588 |
% \changes{v1.0q}{1996/11/04}{Moved check for missing item: only checked |
| 589 |
% when not inlabel flag is false} |
| 590 |
% Because |\par| is sometimes made a no-op it is possible for a missing |
| 591 |
% |\item| to produce a loop that does not fill memory and so never gets |
| 592 |
% trapped by \TeX. We thus need to trap this here by setting |\par| to |
| 593 |
% count the number of times a paragraph ii is called with no progress |
| 594 |
% being made started. |
| 595 |
% \begin{macrocode} |
| 596 |
\def\@trivlist{% |
| 597 |
\if@noskipsec \leavevmode \fi |
| 598 |
\@topsepadd \topsep |
| 599 |
\ifvmode |
| 600 |
\advance\@topsepadd \partopsep |
| 601 |
\else |
| 602 |
\unskip \par |
| 603 |
\fi |
| 604 |
\if@inlabel |
| 605 |
\@noparitemtrue |
| 606 |
\@noparlisttrue |
| 607 |
\else |
| 608 |
\if@newlist \@noitemerr \fi |
| 609 |
\@noparlistfalse |
| 610 |
\@topsep \@topsepadd |
| 611 |
\fi |
| 612 |
\advance\@topsep \parskip |
| 613 |
\leftskip \z@skip |
| 614 |
\rightskip \@rightskip |
| 615 |
\parfillskip \@flushglue |
| 616 |
\par@deathcycles \z@ |
| 617 |
\@setpar{\if@newlist |
| 618 |
\advance\par@deathcycles \@ne |
| 619 |
\ifnum \par@deathcycles >\@m |
| 620 |
\@noitemerr |
| 621 |
{\@@par}% |
| 622 |
\fi |
| 623 |
\else |
| 624 |
{\@@par}% |
| 625 |
\fi}% |
| 626 |
\global \@newlisttrue |
| 627 |
\@outerparskip \parskip} |
| 628 |
% \end{macrocode} |
| 629 |
% \end{macro} |
| 630 |
% |
| 631 |
% \begin{environment}{trivlist} |
| 632 |
% \begin{macro}{\trivlist} |
| 633 |
% \changes{0.0}{1992/03/18}{RmS: added \cs{@nmbrlistfalse}} |
| 634 |
% \begin{macrocode} |
| 635 |
\def\trivlist{% |
| 636 |
\parsep\parskip |
| 637 |
\@nmbrlistfalse |
| 638 |
\@trivlist |
| 639 |
\labelwidth\z@ |
| 640 |
\leftmargin\z@ |
| 641 |
\itemindent\z@ |
| 642 |
% \end{macrocode} |
| 643 |
% |
| 644 |
% We initialise |\@itemlabel| so that a \texttt{trivlist} with |
| 645 |
% an |\item| not having an optional argument doesn't produce an |
| 646 |
% error message. |
| 647 |
% \changes{latex2e}{1993/12/13}{Initialised \cs{@itemlabel}} |
| 648 |
% \begin{macrocode} |
| 649 |
\let\@itemlabel\@empty |
| 650 |
\def\makelabel##1{##1}} |
| 651 |
% \end{macrocode} |
| 652 |
% \end{macro} |
| 653 |
% \end{environment} |
| 654 |
% |
| 655 |
% \begin{macro}{\endlist} |
| 656 |
% \begin{macrocode} |
| 657 |
\def\endlist{% |
| 658 |
\global\advance\@listdepth\m@ne |
| 659 |
\endtrivlist} |
| 660 |
% \end{macrocode} |
| 661 |
% \end{macro} |
| 662 |
% |
| 663 |
% The definition of \cs{trivlist} used to be in ltspace.dtx |
| 664 |
% so that other commands could be `let to it'. |
| 665 |
% They now use \cs{def}. |
| 666 |
% \begin{macro}{\endtrivlist} |
| 667 |
% \changes{v1.2b ltspace}{1994/11/12}{Changed order of tests to make |
| 668 |
% \cs{@noitemerror} correct: end of an era.} |
| 669 |
% \changes{v1.0i}{1995/05/25}{Macros moved from ltspace.dtx} |
| 670 |
% \changes{v1.0n}{1996/10/25}{Change \cs{indent} to \cs{leavevmode}} |
| 671 |
% \changes{v1.0n}{1996/10/25}{Reset flags explicitly} |
| 672 |
% \changes{v1.0o}{1996/10/26}{Correct typo} |
| 673 |
% \begin{macrocode} |
| 674 |
\def\endtrivlist{% |
| 675 |
\if@inlabel |
| 676 |
\leavevmode |
| 677 |
\global \@inlabelfalse |
| 678 |
\fi |
| 679 |
\if@newlist |
| 680 |
\@noitemerr |
| 681 |
\global \@newlistfalse |
| 682 |
\fi |
| 683 |
\ifhmode\unskip \par |
| 684 |
% \end{macrocode} |
| 685 |
% We also check if we are in math mode and issue an error message |
| 686 |
% if so (hoping that |\@currenvir| resolves suitably). Otherwise |
| 687 |
% the usual ``perhaps a missing item'' error will get triggered |
| 688 |
% later which is confusing. |
| 689 |
% \changes{v1.0s}{2002/10/28}{Check for math mode (pr/3437)} |
| 690 |
% \begin{macrocode} |
| 691 |
\else |
| 692 |
\@inmatherr{\end{\@currenvir}}% |
| 693 |
\fi |
| 694 |
\if@noparlist \else |
| 695 |
\ifdim\lastskip >\z@ |
| 696 |
\@tempskipa\lastskip \vskip -\lastskip |
| 697 |
\advance\@tempskipa\parskip \advance\@tempskipa -\@outerparskip |
| 698 |
\vskip\@tempskipa |
| 699 |
\fi |
| 700 |
\@endparenv |
| 701 |
\fi |
| 702 |
} |
| 703 |
% \end{macrocode} |
| 704 |
% \end{macro} |
| 705 |
% |
| 706 |
% |
| 707 |
% |
| 708 |
% \begin{macro}{\@endparenv} |
| 709 |
% \begin{macro}{\@doendpe} |
| 710 |
% To suppress the paragraph indentation in text immediately following |
| 711 |
% a paragraph-making environment, \cs{everypar} is changed to remove the |
| 712 |
% space, and \cs{par} is redefined to restore \cs{everypar}. Instead of |
| 713 |
% redefining \cs{par} and \cs{everypar}, \cs{@endparenv} was changed to |
| 714 |
% set the |@endpe| switch, letting \cs{end} redefine \cs{par} and |
| 715 |
% \cs{everypar}. |
| 716 |
% |
| 717 |
% This allows paragraph-making environments to work right when called |
| 718 |
% by other environments. (Changed 27 Oct 86) |
| 719 |
% |
| 720 |
% In 2024 this logic was partially replaced with a new algorithm: |
| 721 |
% \begin{itemize} |
| 722 |
% \item |
| 723 |
% \cs{if@endpe} is now set globally to \texttt{true} or \texttt{false}. |
| 724 |
% \item |
| 725 |
% In addition \cs{@endpetrue} initiates an \cs{aftergroup} call |
| 726 |
% to \cs{propagate@doendpe} if it is used inside a group. |
| 727 |
% \item |
| 728 |
% \cs{propagate@doendpe} in turn checks the status of \cs{if@endpe} |
| 729 |
% and if that is \texttt{true} it calls \cs{@doendpe} otherwise it |
| 730 |
% does nothing. |
| 731 |
% \item |
| 732 |
% \cs{@doendpe} in turn calls \cs{@endpetrue} and also makes the |
| 733 |
% necessary changes to |
| 734 |
% \cs{par} and \cs{everypar} so that they handle as before any |
| 735 |
% empty line that follows the environment. |
| 736 |
% \item |
| 737 |
% Because of the \cs{@endpetrue} we get another \cs{aftergroup}, so the |
| 738 |
% mechanisnm slowly migrates out of several groups if those follow |
| 739 |
% immediately after the end of the environment. If, however, there is a new |
| 740 |
% paragraph started or an explicit \cs{par} before the next group ends then this will |
| 741 |
% result in a call to \cs{@endpefalse} and the migration stops |
| 742 |
% (note that \cs{propagate@doendpe} is still called once after the group but does nothing). |
| 743 |
% \item |
| 744 |
% Using this approach something like |
| 745 |
%\begin{verbatim} |
| 746 |
% {% some customization here |
| 747 |
% \begin{equation} |
| 748 |
% x=y |
| 749 |
% \end{equation}} |
| 750 |
% some text |
| 751 |
%\end{verbatim} |
| 752 |
% is still correctly identified as a paragraph continuation so that |
| 753 |
% there is no indentation before \texttt{some text}. |
| 754 |
% \item |
| 755 |
% We can get away with using global settings of \cs{if@endpe} even |
| 756 |
% in nested situations (without keeping track of the status in a |
| 757 |
% stack), because the switch change is made only at |
| 758 |
% the very end of such environments, basically directly before the |
| 759 |
% \cs{endgroup} in \cs{end}, and it is later set back to \texttt{false} by |
| 760 |
% the next \cs{everypar} or the next \cs{par}. Even if the |
| 761 |
% environment is called without using \cs{begin} \cs{end}, the |
| 762 |
% situation doesn't change (or rather cause a problem). |
| 763 |
% \item |
| 764 |
% However, there is one scenario where the new approach would |
| 765 |
% change the behavior. If a box is being built, e.g., with |
| 766 |
% \cs{setbox}, we have now the case that a \cs{@endpetrue} |
| 767 |
% inside would migrate out into a context in which it should not be |
| 768 |
% true (because the box might get used elsewhere, e.g., a float). |
| 769 |
% In the past, due to local switch changes, that didn't happen, i.e., |
| 770 |
% \cs{if@endpe} would revert to \texttt{false} at the end of the box |
| 771 |
% definition. |
| 772 |
% \item |
| 773 |
% Thus, to avoid that one has to explicitly set it back to false at |
| 774 |
% the end of such constructions, just as we also need to prevent |
| 775 |
% colors from |
| 776 |
% migrating out. Thus the correct place to do this is |
| 777 |
% in \cs{color@endgroup} because that is always called at that point. |
| 778 |
% \end{itemize} |
| 779 |
% \begin{macrocode} |
| 780 |
\def\@endparenv{% |
| 781 |
\addpenalty\@endparpenalty\addvspace\@topsepadd\@endpetrue} |
| 782 |
% \end{macrocode} |
| 783 |
% |
| 784 |
% \begin{macrocode} |
| 785 |
%<latexrelease>\IncludeInRelease{2015/01/01}{\@doendpe}{clubpenalty fix}% |
| 786 |
\def\@doendpe{\@endpetrue |
| 787 |
\def\par{\@restorepar |
| 788 |
% \end{macrocode} |
| 789 |
% If a section heading changes |\clubpenalty| to keep lines |
| 790 |
% after it together then this modification is restored via the |
| 791 |
% |\everypar| mechanism at the start of the next paragraph. As we |
| 792 |
% destroy the contents of this token here we explicitly set |
| 793 |
% |\clubpenalty| back to its default. |
| 794 |
% \changes{v1.0t}{2015/05/10}{Explicitly reset \cs{clubpenalty} before |
| 795 |
% clearing \cs{everypar}; see also pr/0462 and pr/4065} |
| 796 |
% \changes{v1.0u}{2024/06/23}{Set \cs{if@endpe} to \texttt{false} |
| 797 |
% before calling \cs{par} (needed for tagging)} |
| 798 |
% \begin{macrocode} |
| 799 |
\clubpenalty\@clubpenalty |
| 800 |
\@endpefalse |
| 801 |
\everypar{}\par}% |
| 802 |
% \end{macrocode} |
| 803 |
% |
| 804 |
% Use |\setbox0=\lastbox| instead of |\hskip -\parindent| |
| 805 |
% so that a \cs{noindent} becomes a no-op when used before |
| 806 |
% a line immediately following a list environment(23 Oct 86). |
| 807 |
% \changes{v1.0k}{1995/11/07}{Enclosed \cs{setbox0} assignment by a |
| 808 |
% group so that it leaves the contents of box $0$ intact.} |
| 809 |
% \begin{macrocode} |
| 810 |
\everypar |
| 811 |
{{\setbox\z@\lastbox}% |
| 812 |
\everypar{}\@endpefalse}} |
| 813 |
%<latexrelease>\EndIncludeInRelease |
| 814 |
% \end{macrocode} |
| 815 |
% |
| 816 |
% \begin{macrocode} |
| 817 |
%<latexrelease>\IncludeInRelease{0000/00/00}{\@doendpe}{clubpenalty fix}% |
| 818 |
%<latexrelease>\def\@doendpe{\@endpetrue |
| 819 |
%<latexrelease> \def\par{\@restorepar\everypar{}\par\@endpefalse}\everypar |
| 820 |
%<latexrelease> {{\setbox\z@\lastbox}\everypar{}\@endpefalse}} |
| 821 |
%<latexrelease>\EndIncludeInRelease |
| 822 |
% \end{macrocode} |
| 823 |
% \end{macro} |
| 824 |
% \end{macro} |
| 825 |
% |
| 826 |
% |
| 827 |
% \begin{macro}{\if@endpe} |
| 828 |
% \begin{macro}{\@endpefalse} |
| 829 |
% \begin{macro}{\@endpetrue} |
| 830 |
% \begin{macro}{\propagate@doendpe} |
| 831 |
% As outlined above these are no longer simple switches, but we |
| 832 |
% keep the name because it is used all over the place. |
| 833 |
% \begin{macrocode} |
| 834 |
\newif\if@endpe |
| 835 |
% \end{macrocode} |
| 836 |
% |
| 837 |
% \changes{v1.0u}{2024/06/23}{Set \cs{if@endpe} globally and also set |
| 838 |
% up migration to the outside} |
| 839 |
% \begin{macrocode} |
| 840 |
%</2ekernel> |
| 841 |
%<*2ekernel|latexrelease> |
| 842 |
%<latexrelease>\IncludeInRelease{2024/11/01}% |
| 843 |
%<latexrelease> {\@endpetrue}{New @endpe handling}% |
| 844 |
% \end{macrocode} |
| 845 |
% |
| 846 |
% \begin{macrocode} |
| 847 |
\def\@endpefalse{\global\let\if@endpe\iffalse} |
| 848 |
% \end{macrocode} |
| 849 |
% |
| 850 |
% \begin{macrocode} |
| 851 |
\def\@endpetrue {% |
| 852 |
\global\let\if@endpe\iftrue |
| 853 |
% \end{macrocode} |
| 854 |
% If we are inside a simple or a semi-simple group then propagate |
| 855 |
% to the outside, for all other group types do nothing. Normally, we |
| 856 |
% would start out in the group opened by \cs{begin} (type 14). When we |
| 857 |
% migrate out of that we are either on top-level (type 0) or in |
| 858 |
% another semi-simple group (type 14) or |
| 859 |
% in some other group. Thus, the best order of tests is to first |
| 860 |
% test for 14, then for 0 and finally for 1 (simple group). |
| 861 |
% \changes{v1.0v}{2025/01/26}{Only migrate \cs{@doendpe} out of simple |
| 862 |
% and semi-simple groups (gh1641)} |
| 863 |
% \begin{macrocode} |
| 864 |
\ifnum\currentgrouptype =14 % semi-simple group |
| 865 |
\aftergroup\propagate@doendpe |
| 866 |
\else |
| 867 |
\ifnum\currentgrouptype =\z@ % no group: top-level |
| 868 |
\else |
| 869 |
\ifnum\currentgrouptype =\@ne % simple group |
| 870 |
\aftergroup\propagate@doendpe |
| 871 |
\fi |
| 872 |
\fi |
| 873 |
\fi |
| 874 |
} |
| 875 |
% \end{macrocode} |
| 876 |
% If \cs{if@endpe} is still true after the group ends, we run \cs{@doendpe} |
| 877 |
% that in turn runs another \cs{@endpetrue} (besides other things), |
| 878 |
% thus propagating further if necessary. |
| 879 |
% However, if the endpe situation got resolved and \cs{if@endpe} is \texttt{false} |
| 880 |
% then nothing further happens. |
| 881 |
% \begin{macrocode} |
| 882 |
\def\propagate@doendpe{\if@endpe \@doendpe \fi} |
| 883 |
% \end{macrocode} |
| 884 |
% \begin{macrocode} |
| 885 |
%</2ekernel|latexrelease> |
| 886 |
%<latexrelease>\EndIncludeInRelease |
| 887 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 888 |
%<latexrelease> {\@endpetrue}{New @endpe handling}% |
| 889 |
%<latexrelease> |
| 890 |
%<latexrelease> |
| 891 |
%<latexrelease>\def\@endpefalse{\let\if@endpe\iffalse} |
| 892 |
%<latexrelease>\def\@endpetrue{\let\if@endpe\iftrue} |
| 893 |
%<latexrelease> |
| 894 |
%<latexrelease>\EndIncludeInRelease |
| 895 |
%<*2ekernel> |
| 896 |
% \end{macrocode} |
| 897 |
% \end{macro}\end{macro}\end{macro}\end{macro} |
| 898 |
% |
| 899 |
% |
| 900 |
% \begin{macro}{\@mklab} |
| 901 |
% \begin{macrocode} |
| 902 |
\def\@mklab#1{\hfil #1} |
| 903 |
% \end{macrocode} |
| 904 |
% \end{macro} |
| 905 |
% |
| 906 |
% \begin{macro}{\item} |
| 907 |
% \changes{LaTeX2.09}{1992/09/18} |
| 908 |
% {(RmS) Added warning if \cs{item} is used in math mode} |
| 909 |
% \changes{v1.0c}{1994/04/28} |
| 910 |
% {Replaced \cs{@ltxnomath} by \cs{@inmatherr}} |
| 911 |
% \changes{v1.0d}{1994/05/03} |
| 912 |
% {Removed superfluous braces} |
| 913 |
% \begin{macrocode} |
| 914 |
\def\item{% |
| 915 |
\@inmatherr\item |
| 916 |
\@ifnextchar [\@item{\@noitemargtrue \@item[\@itemlabel]}} |
| 917 |
% \end{macrocode} |
| 918 |
% \end{macro} |
| 919 |
% \begin{macro}{\@donoparitem} |
| 920 |
% \begin{macrocode} |
| 921 |
\def\@donoparitem{% |
| 922 |
\@noparitemfalse |
| 923 |
\global\setbox\@labels\hbox{\hskip -\leftmargin |
| 924 |
\unhbox\@labels |
| 925 |
\hskip \leftmargin}% |
| 926 |
\if@minipage\else |
| 927 |
\@tempskipa\lastskip |
| 928 |
\vskip -\lastskip |
| 929 |
\advance\@tempskipa\@outerparskip |
| 930 |
\advance\@tempskipa -\parskip |
| 931 |
\vskip\@tempskipa |
| 932 |
\fi} |
| 933 |
% \end{macrocode} |
| 934 |
% \end{macro} |
| 935 |
% |
| 936 |
% \begin{macro}{\@item} |
| 937 |
% \changes{v1.0l}{1996/07/26}{Remove unnecessary \cs{global} before |
| 938 |
% \cs{@minipage...}} |
| 939 |
% \begin{macrocode} |
| 940 |
\def\@item[#1]{% |
| 941 |
\if@noparitem |
| 942 |
\@donoparitem |
| 943 |
\else |
| 944 |
\if@inlabel |
| 945 |
\indent \par |
| 946 |
\fi |
| 947 |
\ifhmode |
| 948 |
\unskip\unskip \par |
| 949 |
\fi |
| 950 |
\if@newlist |
| 951 |
\if@nobreak |
| 952 |
\@nbitem |
| 953 |
\else |
| 954 |
\addpenalty\@beginparpenalty |
| 955 |
\addvspace\@topsep |
| 956 |
\addvspace{-\parskip}% |
| 957 |
\fi |
| 958 |
\else |
| 959 |
\addpenalty\@itempenalty |
| 960 |
\addvspace\itemsep |
| 961 |
\fi |
| 962 |
\global\@inlabeltrue |
| 963 |
\fi |
| 964 |
\everypar{% |
| 965 |
\@minipagefalse |
| 966 |
\global\@newlistfalse |
| 967 |
% \end{macrocode} |
| 968 |
% This |\if@inlabel| check is needed in case an item starts of |
| 969 |
% inside a group so that |\everypar| does not become empty |
| 970 |
% outside that group. |
| 971 |
% \begin{macrocode} |
| 972 |
\if@inlabel |
| 973 |
\global\@inlabelfalse |
| 974 |
% \end{macrocode} |
| 975 |
% The paragraph indent is now removed by using |\setbox...| since |
| 976 |
% this makes |\noindent| a no-op here, as it should be. Thus the |
| 977 |
% following comment is redundant but is left here for the sake of |
| 978 |
% future historians: |
| 979 |
% this next command was changed from an hskip to a kern to avoid |
| 980 |
% a break point after the parindent box: the skip could cause a |
| 981 |
% line-break if a very long label occurs in raggedright setting. |
| 982 |
% \changes{v1.0d}{1994/05/03}{\cs{hskip} changed to \cs{kern}} |
| 983 |
% \changes{v1.0m}{1996/10/23}{\cs{kern...} changed to \cs{setbox...}} |
| 984 |
% \changes{v1.0r}{1997/02/21} |
| 985 |
% {\cs{ifvoid} check added for \cs{noindent}. latex/2414} |
| 986 |
% If |\noindent| was used after |\item| want to cancel the |\itemindent| |
| 987 |
% skip. This case can be detected as the indentation box will be void. |
| 988 |
% \begin{macrocode} |
| 989 |
{\setbox\z@\lastbox |
| 990 |
\ifvoid\z@ |
| 991 |
\kern-\itemindent |
| 992 |
\fi}% |
| 993 |
% \end{macrocode} |
| 994 |
% |
| 995 |
% \begin{macrocode} |
| 996 |
\box\@labels |
| 997 |
\penalty\z@ |
| 998 |
\fi |
| 999 |
% \end{macrocode} |
| 1000 |
% This code is intended to prevent a page break after the first |
| 1001 |
% line of an item that comes immediately after a section title. It |
| 1002 |
% may be sensible to always forbid a page break after one line of |
| 1003 |
% an item? As with all such settings of |\clubpenalty| it is local |
| 1004 |
% so will have no effect if the item starts in a group. |
| 1005 |
% |
| 1006 |
% Only resetting |@nobreak| when it is true is now |
| 1007 |
% essential since now it is sometimes set locally. |
| 1008 |
% \changes{v1.0m}{1996/10/23}{Added setting of \cs{clubpenalty} and |
| 1009 |
% set \cs{@nobreakfalse} only when necessary} |
| 1010 |
% \begin{macrocode} |
| 1011 |
\if@nobreak |
| 1012 |
\@nobreakfalse |
| 1013 |
\clubpenalty \@M |
| 1014 |
\else |
| 1015 |
\clubpenalty \@clubpenalty |
| 1016 |
\everypar{}% |
| 1017 |
\fi}% |
| 1018 |
% \end{macrocode} |
| 1019 |
% \changes{v1.0l}{1996/07/26}{Remove unnecessary \cs{global} before |
| 1020 |
% \cs{@nobreak...}} |
| 1021 |
% \changes{v1.0m}{1996/10/23}{\cs{@nobreak...} moved into the |
| 1022 |
% \cs{everypar} and not executed unconditionally, see above} |
| 1023 |
% \begin{macrocode} |
| 1024 |
\if@noitemarg |
| 1025 |
\@noitemargfalse |
| 1026 |
\if@nmbrlist |
| 1027 |
% \end{macrocode} |
| 1028 |
% \changes{v1.0g}{1995/05/17}{Removed surplus braces} |
| 1029 |
% \begin{macrocode} |
| 1030 |
\refstepcounter\@listctr |
| 1031 |
\fi |
| 1032 |
\fi |
| 1033 |
% \end{macrocode} |
| 1034 |
% We use |\sbox| to support colour commands. |
| 1035 |
% \changes{LaTeX2e}{1993/12/08}{use \cs{sbox} to support colour} |
| 1036 |
% \begin{macrocode} |
| 1037 |
\sbox\@tempboxa{\makelabel{#1}}% |
| 1038 |
\global\setbox\@labels\hbox{% |
| 1039 |
\unhbox\@labels |
| 1040 |
\hskip \itemindent |
| 1041 |
\hskip -\labelwidth |
| 1042 |
\hskip -\labelsep |
| 1043 |
\ifdim \wd\@tempboxa >\labelwidth |
| 1044 |
\box\@tempboxa |
| 1045 |
% \end{macrocode} |
| 1046 |
% \changes{LaTeX2.09}{1991/11/22} |
| 1047 |
% {(RmS) Changed second call to \cs{makelabel} to |
| 1048 |
% \cs{unhbox}\cs{@tempboxa}. |
| 1049 |
% Avoids problems with side effects in \cs{makelabel} and is |
| 1050 |
% more efficient.} |
| 1051 |
% \begin{macrocode} |
| 1052 |
\else |
| 1053 |
\hbox to\labelwidth {\unhbox\@tempboxa}% |
| 1054 |
\fi |
| 1055 |
\hskip \labelsep}% |
| 1056 |
\ignorespaces} |
| 1057 |
% \end{macrocode} |
| 1058 |
% \end{macro} |
| 1059 |
% |
| 1060 |
% \begin{macro}{\makelabel} |
| 1061 |
% \changes{LaTeX2.09}{1991/11/04} |
| 1062 |
% {(RmS) added default definition for \cs{makelabel}, |
| 1063 |
% to produce an error message.} |
| 1064 |
% \begin{macrocode} |
| 1065 |
\def\makelabel#1{% |
| 1066 |
\@latex@error{Lonely \string\item--perhaps a missing |
| 1067 |
list environment}\@ehc} |
| 1068 |
% \end{macrocode} |
| 1069 |
% \end{macro} |
| 1070 |
% |
| 1071 |
% \begin{macro}{\@nbitem} |
| 1072 |
% \changes{v1.0g}{1995/05/17}{Removed surplus braces} |
| 1073 |
% \begin{macrocode} |
| 1074 |
\def\@nbitem{% |
| 1075 |
\@tempskipa\@outerparskip |
| 1076 |
\advance\@tempskipa -\parskip |
| 1077 |
\addvspace\@tempskipa} |
| 1078 |
% \end{macrocode} |
| 1079 |
% \end{macro} |
| 1080 |
% |
| 1081 |
% \begin{macro}{\usecounter} |
| 1082 |
% \begin{macrocode} |
| 1083 |
\def\usecounter#1{\@nmbrlisttrue\def\@listctr{#1}\setcounter{#1}\z@} |
| 1084 |
% \end{macrocode} |
| 1085 |
% \end{macro} |
| 1086 |
% |
| 1087 |
% |
| 1088 |
% \subsection{Itemize and Enumerate} |
| 1089 |
% |
| 1090 |
% Enumeration is done with four counters: |enumi|, |enumii|, |enumiii| |
| 1091 |
% and |enumiv|, where |enum|N controls the numbering of the Nth level |
| 1092 |
% enumeration. The label is generated by the commands |
| 1093 |
% \cs{labelenumi} \ldots{} \cs{labelenumiv}, which should be defined |
| 1094 |
% by the document style. |
| 1095 |
% Note that \cs{p@enum}N\cs{theenum}N defines the output |
| 1096 |
% of a \cs{ref} command. A typical definition might be: |
| 1097 |
% \begin{verbatim} |
| 1098 |
% \def\theenumii{\alph{enumii}} |
| 1099 |
% \def\p@enumii{\theenumi} |
| 1100 |
% \def\labelenumii{(\theenumii)} |
| 1101 |
% \end{verbatim} |
| 1102 |
% which will print the labels as `(a)', `(b)', \ldots |
| 1103 |
% and print a \cs{ref} as `3a'. |
| 1104 |
% |
| 1105 |
% The item numbers are moved to the right of the label box, so they are |
| 1106 |
% always a distance of \cs{labelsep} from the item. |
| 1107 |
% |
| 1108 |
% \cs{@enumdepth} holds the current enumeration nesting depth. |
| 1109 |
% |
| 1110 |
% Itemization is controlled by four commands: \cs{labelitemi}, |
| 1111 |
% \cs{labelitemii}, |
| 1112 |
% \cs{labelitemiii}, and \cs{labelitemiv}. |
| 1113 |
% To cause the second-level list to be |
| 1114 |
% bulleted, you just define \cs{labelitemii} |
| 1115 |
% to be $\bullet$. \cs{@itemspacing} |
| 1116 |
% and \cs{@itemdepth} are the analogs of \cs{@enumspacing} and |
| 1117 |
% \cs{@enumdepth}. |
| 1118 |
% |
| 1119 |
% \begin{oldcomments} |
| 1120 |
% \enumerate == |
| 1121 |
% BEGIN |
| 1122 |
% if \@enumdepth > 3 |
| 1123 |
% then errormessage: ``Too deeply nested''. |
| 1124 |
% else \@enumdepth :=L \@enumdepth + 1 |
| 1125 |
% \@enumctr :=L eval(enum@\romannumeral\the\@enumdepth) |
| 1126 |
% \list{\label(\@enumctr)} |
| 1127 |
% {\usecounter{\@enumctr} |
| 1128 |
% \makelabel{LABEL} == \hss \llap{LABEL}} |
| 1129 |
% fi |
| 1130 |
% END |
| 1131 |
% |
| 1132 |
% \endenumerate == \endlist |
| 1133 |
% \end{oldcomments} |
| 1134 |
% |
| 1135 |
% \begin{macro}{\@enumdepth} |
| 1136 |
% \begin{macrocode} |
| 1137 |
\newcount\@enumdepth \@enumdepth = 0 |
| 1138 |
% \end{macrocode} |
| 1139 |
% \end{macro} |
| 1140 |
% |
| 1141 |
% \begin{macro}{\c@enumi} |
| 1142 |
% \begin{macro}{\c@enumii} |
| 1143 |
% \begin{macro}{\c@enumii} |
| 1144 |
% \begin{macro}{\c@enumiv} |
| 1145 |
% \begin{macrocode} |
| 1146 |
\@definecounter{enumi} |
| 1147 |
\@definecounter{enumii} |
| 1148 |
\@definecounter{enumiii} |
| 1149 |
\@definecounter{enumiv} |
| 1150 |
% \end{macrocode} |
| 1151 |
% \end{macro} |
| 1152 |
% \end{macro} |
| 1153 |
% \end{macro} |
| 1154 |
% \end{macro} |
| 1155 |
% |
| 1156 |
% \begin{environment}{enumerate} |
| 1157 |
% \changes{v1.0g}{1995/05/17}{Use \cs{thr@@} and remove surplus braces} |
| 1158 |
% \begin{macrocode} |
| 1159 |
\def\enumerate{% |
| 1160 |
\ifnum \@enumdepth >\thr@@\@toodeep\else |
| 1161 |
\advance\@enumdepth\@ne |
| 1162 |
\edef\@enumctr{enum\romannumeral\the\@enumdepth}% |
| 1163 |
% \end{macrocode} |
| 1164 |
% |
| 1165 |
% \changes{v1.0j}{1995/07/09}{Use \cs{expandafter}} |
| 1166 |
% \begin{macrocode} |
| 1167 |
\expandafter |
| 1168 |
\list |
| 1169 |
\csname label\@enumctr\endcsname |
| 1170 |
{\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}% |
| 1171 |
\fi} |
| 1172 |
% \end{macrocode} |
| 1173 |
% |
| 1174 |
% \begin{macrocode} |
| 1175 |
\let\endenumerate =\endlist |
| 1176 |
% \end{macrocode} |
| 1177 |
% \end{environment} |
| 1178 |
% |
| 1179 |
% |
| 1180 |
% \begin{oldcomments} |
| 1181 |
% \itemize == |
| 1182 |
% BEGIN |
| 1183 |
% if \@itemdepth > 3 |
| 1184 |
% then errormessage: 'Too deeply nested'. |
| 1185 |
% else \@itemdepth :=L \@itemdepth + 1 |
| 1186 |
% \@itemitem == eval(labelitem\romannumeral\the\@itemdepth) |
| 1187 |
% \list{\@nameuse{\@itemitem}} |
| 1188 |
% {\makelabel{LABEL} == \hss \llap{LABEL}} |
| 1189 |
% fi |
| 1190 |
% END |
| 1191 |
% |
| 1192 |
% \enditemize == \endlist |
| 1193 |
% |
| 1194 |
% \end{oldcomments} |
| 1195 |
% |
| 1196 |
% \begin{macro}{\@itemdepth} |
| 1197 |
% \begin{macrocode} |
| 1198 |
\newcount\@itemdepth \@itemdepth = 0 |
| 1199 |
% \end{macrocode} |
| 1200 |
% \end{macro} |
| 1201 |
% |
| 1202 |
% \begin{environment}{itemize} |
| 1203 |
% \changes{v1.0g}{1995/05/17}{Use \cs{thr@@}} |
| 1204 |
% \begin{macrocode} |
| 1205 |
\def\itemize{% |
| 1206 |
\ifnum \@itemdepth >\thr@@\@toodeep\else |
| 1207 |
\advance\@itemdepth\@ne |
| 1208 |
\edef\@itemitem{labelitem\romannumeral\the\@itemdepth}% |
| 1209 |
% \end{macrocode} |
| 1210 |
% |
| 1211 |
% \changes{v1.0j}{1995/07/09}{Use \cs{expandafter}} |
| 1212 |
% \begin{macrocode} |
| 1213 |
\expandafter |
| 1214 |
\list |
| 1215 |
\csname\@itemitem\endcsname |
| 1216 |
{\def\makelabel##1{\hss\llap{##1}}}% |
| 1217 |
\fi} |
| 1218 |
% \end{macrocode} |
| 1219 |
% |
| 1220 |
% \begin{macrocode} |
| 1221 |
\let\enditemize =\endlist |
| 1222 |
%</2ekernel> |
| 1223 |
% \end{macrocode} |
| 1224 |
% \end{environment} |
| 1225 |
% |
| 1226 |
% \Finale |
| 1227 |
% |