Debian Codegraph @

texmf-dist/source/latex/revtex4/ltxutil.dtx

raw
1 % \iffalse ltxdoc klootch
2 % ltxutil.dtx: package to add utilties to LaTeX
3 % Copyright (c) 2000 Arthur Ogawa
4 %
5 % Disclaimer
6 % This file is distributed WITHOUT ANY WARRANTY;
7 % without even the implied warranty of
8 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 % ReadMe
10 % For the documentation and more detailed instructions for
11 % installation, typeset this document with \LaTeX.
12 % \fi
13 % \GetFileInfo{ltxutil.dtx}
14 %
15 % \iffalse ltxdoc klootch
16 %<*ltxutil>
17 %%% @LaTeX-file{
18 %%% filename = "ltxutil.dtx",
19 %%% version = "1.0d",
20 %%% date = "2020/09/30",
21 %%% author = "Arthur Ogawa (mailto:[email protected]),
22 %%% Phelype Oleinik (mailto:phelype.oleinik at latex-project.org),
23 %%% commissioned by the American Physical Society.
24 %%% ",
25 %%% copyright = "Copyright (C) 1999 Arthur Ogawa,
26 %%% distributed under the terms of the
27 %%% LaTeX Project Public License, see
28 %%% ftp://ctan.tug.org/macros/latex/base/lppl.txt
29 %%% ",
30 %%% address = "Arthur Ogawa,
31 %%% USA",
32 %%% telephone = "",
33 %%% FAX = "",
34 %%% email = "[email protected]",
35 %%% codetable = "ISO/ASCII",
36 %%% keywords = "latex, utility, kernel",
37 %%% supported = "yes",
38 %%% abstract = "package to add utilties to LaTeX",
39 %%% }
40 %</ltxutil>
41 % \fi
42 %
43 % \iffalse ltxdoc klootch
44 % The following references the \file{00readme.txt} file,
45 % which contains basic information about this package.
46 % The contents of this file are generated when
47 % you typeset the programmer's documentation.
48 % Search on "{filecontents*}{00readme.txt}" to locate it.
49 % \fi\input{00readme.txt}%
50 %
51 % \subsection{Bill of Materials}
52 %
53 % Following is a list of the files in this distribution arranged
54 % according to provenance.
55 %
56 % \subsubsection{Primary Source}%
57 % One single file generates all.
58 %\begin{verbatim}
59 %ltxutil.dtx
60 %\end{verbatim}
61 %
62 % \subsubsection{Generated by \texttt{latex ltxutil.dtx}}%
63 % Typesetting the source file under \LaTeX\
64 % generates the readme and the installer.
65 %\begin{verbatim}
66 %00readme.txt ltxutil.ins
67 %\end{verbatim}
68 %
69 % \subsubsection{Generated by \texttt{tex ltxutil.ins}}%
70 % Typesetting the installer generates
71 % the package files.
72 %\begin{verbatim}
73 %ltxutil.sty
74 %\end{verbatim}
75 %
76 % \subsubsection{Documentation}%
77 % The following are the online documentation:
78 % \begin{verbatim}
79 %ltxutil.pdf
80 % \end{verbatim}
81 %
82 % \subsubsection{Auxiliary}%
83 % The following are auxiliary files generated
84 % in the course of running \LaTeX:
85 % \begin{verbatim}
86 %ltxutil.aux ltxutil.idx ltxutil.ind ltxutil.log ltxutil.toc
87 % \end{verbatim}
88 %
89 % \section{Code common to all modules}%
90 %
91 % The following may look a bit klootchy, but we
92 % want to require only one place in this file
93 % where the version number is stated,
94 % and we also want to ensure that the version
95 % number is embedded into every generated file.
96 %
97 % Now we declare that
98 % these files can only be used with \LaTeXe.
99 % An appropriate message is displayed if
100 % a different \TeX{} format is used.
101 % \begin{macrocode}
102 %<*doc|ltxutil>
103 \NeedsTeXFormat{LaTeX2e}[1995/12/01]%
104 %</doc|ltxutil>
105 % \end{macrocode}
106 % As desired, the following modules all
107 % take common version information:
108 % \begin{macrocode}
109 %<ltxutil>\ProvidesFile{ltxutil.sty}%
110 %<*doc>
111 \expandafter\ProvidesFile\expandafter{\jobname.dtx}%
112 %</doc>
113 % \end{macrocode}
114 %
115 % The following line contains, for once and for all,
116 % the version and date information.
117 % By various means, this information is reproduced
118 % consistently in all generated files and in the
119 % typeset documentation.
120 % \begin{macrocode}
121 %<*doc|ltxutil>
122 [2020/09/30 1.0d utilities package]% \fileversion
123 %</doc|ltxutil>
124 % \end{macrocode}
125 %
126 %
127 % \section{The driver module \texttt{doc}}
128 %
129 % This module, consisting of the present section,
130 % typesets the programmer's documentation,
131 % generating the \file{.ins} installer and \file{00readme.txt} as required.
132 %
133 % Because the only uncommented-out lines of code at the beginning of
134 % this file constitute the \file{doc} module itself,
135 % we can simply typeset the \file{.dtx} file directly,
136 % and there is thus rarely any need to
137 % generate the ``doc'' {\sc docstrip} module.
138 % Module delimiters are nonetheless required so that
139 % this code does not find its way into the other modules.
140 %
141 % The \enve{document} command concludes the typesetting run.
142 %
143 % \begin{macrocode}
144 %<*doc>
145 % \end{macrocode}
146 %
147 % \subsection{The Preamble}
148 % The programmers documentation is formatted
149 % with the \classname{ltxdoc} class with local customizations,
150 % and with the usual code line indexing.
151 % \begin{macrocode}
152 \documentclass{ltxdoc}
153 \RequirePackage{ltxdocext}%
154 \let\url\undefined
155 \RequirePackage[colorlinks=true,linkcolor=blue]{hyperref}%
156 \pdfstringdefDisableCommands{%
157 \let\file\relax
158 \let\sc\relax
159 }
160 \makeatletter
161 \@ifundefined{package@font}{}%
162 {\expandafter\RequirePackage\expandafter{\csname package@font\endcsname}}
163 \makeatother
164 \CodelineIndex\EnableCrossrefs
165 % \end{macrocode}
166 %
167 % \subsubsection{Docstrip and info directives}
168 % We use so many {\sc docstrip} modules that we set the
169 % \texttt{StandardModuleDepth} counter to 1.
170 % \begin{macrocode}
171 \setcounter{StandardModuleDepth}{1}
172 % \end{macrocode}
173 % The following command retrieves the date and version information
174 % from this file.
175 % \begin{macrocode}
176 \expandafter\GetFileInfo\expandafter{\jobname.dtx}%
177 % \end{macrocode}
178 %
179 %
180 % \subsection{The installer file}
181 %
182 % The installer \file{ltxutil.ins} appears here.
183 % If you have retrieved the standard distribution of this package,
184 % the installer file is already on your filesystem.
185 % If you are bootstrapping,
186 % the first typesetting of the \file{.dtx} file
187 % will cause the installer to be generated.
188 %
189 % The following modules are used to direct
190 % {\sc docstrip} in generating the external files:
191 % \begin{center}
192 % \begin{tabular}{lll}
193 % \textbf{Module}&\textbf{File}&\textbf{Description}\\
194 % doc &\file{ltxutil.drv}&driver for programmer's documentation\\
195 % ltxutil,ltxutil-krn &\file{ltxutil.sty}&this package\\
196 % ltxutil-krn& &the portion of this package suitable for inclusion within another package
197 % \end{tabular}
198 % \end{center}
199 %
200 % \begin{macrocode}
201 \begin{filecontents}{ltxutil.ins}
202 %% This file will generate documentation and runtime files
203 %% from ltxutil.dtx when run through LaTeX or TeX.
204 \input docstrip
205 \preamble
206
207 This is a generated file;
208 altering it directly is inadvisable;
209 instead, modify the original source file.
210 See the URL in the file 00readme.txt.
211
212 Copyright notice.
213
214 These files are distributed
215 WITHOUT ANY WARRANTY; without even the implied warranty of
216 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
217
218 \endpreamble
219 \keepsilent
220 \generate{%
221 \file{ltxutil.drv}{\from{ltxutil.dtx}{doc}}%
222 \file{ltxutil.sty}{%
223 \from{ltxutil.dtx}{ltxutil,ltxutil-krn}%
224 }%
225 }%
226 \ifToplevel{
227 \Msg{***********************************************************}
228 \Msg{*}
229 \Msg{* To finish the installation, please move}
230 \Msg{* ltxutil.sty}
231 \Msg{* into a directory searched by TeX.}
232 \Msg{*}
233 \Msg{* To produce the documentation,
234 run ltxutil.dtx through LaTeX.}
235 \Msg{*}
236 \Msg{* Happy TeXing}
237 \Msg{***********************************************************}
238 }
239 \endbatchfile
240 \end{filecontents}
241 % \end{macrocode}
242 % Note that, because all of the files generated by the installer
243 % are part of the standard distribution, it will
244 % be necessary to run the installer only when bootstrapping
245 % (or, of course, during development).
246 % Note, too, that it is rare to generate the \file{doc}
247 % module because it suffices to simply typeset the \file{.dtx} file itself.
248 %
249 % \subsection{The ``Read Me'' File}
250 % As promised above, here is the contents of the
251 % ``Read Me'' file. That file serves a double purpose,
252 % since it also constitutes the beginining of the
253 % programmer's documentation. What better thing, after
254 % all, to have appear at the beginning of the
255 % typeset documentation?
256 %
257 % A good discussion of how to write a ReadMe file can be found in
258 % Engst, Tonya, ``Writing a ReadMe File? Read This''
259 % \emph{MacTech} October 1998, p. 58.
260 %
261 % Note the appearance of the
262 % \cmd\StopEventually\ command, which marks the
263 % dividing line between the user documentation
264 % and the programmer documentation.
265 %
266 % The usual user will not be asked to
267 % do a full build, not to speak
268 % of the bootstrap.
269 % Instructions for carrying these processes
270 % begin the programmer's manual.
271 %
272 % \begin{macrocode}
273 \begin{filecontents*}{00readme.txt}
274 \title{%
275 A \LaTeX\ Package of utility macros%
276 \thanks{%
277 This file has version number \fileversion,
278 last revised \filedate.%
279 % For version number and date,
280 % search on "\fileversion" in the .dtx file,
281 % or see the end of the 00readme.txt file.
282 }%
283 }%
284
285 \author{%
286 Arthur Ogawa (\texttt{mailto:[email protected]}),
287 \fileversion\\Copyright (C) 1999 Arthur Ogawa
288 }%
289 \maketitle
290
291 This file embodies the \classname{ltxutil} package,
292 the implementation and its user documentation.
293
294 The distribution point for this work is
295 \url{ftp://ftp.teleport.com/users/ogawa/macros/latex/contrib/supported/ltxutil...},
296 which contains fully unpacked, prebuilt runtime files and documentation.
297
298 The \classname{ltxutil} package was commissioned by the American Physical Society
299 and is distributed under the terms of the \LaTeX\ Project Public License,
300 the same license under which all the portions of \LaTeX\ itself is distributed.
301 Please see \url{http://ctan.tug.org/macros/latex/base/lppl.txt} for details.
302
303 To use this document class, you must have a working
304 \TeX\ installation equipped with \LaTeXe\
305 and possibly pdftex and Adobe Acrobat Reader or equivalent.
306
307 To install, retrieve the distribution,
308 unpack it into a directory on the target computer,
309 and move the file \file{ltxutil.sty}
310 into a location in your filesystem where it will be found by \LaTeX.
311
312 To use, read the user documentation \file{ltxutil.pdf}.
313
314 \tableofcontents
315
316 \section{Processing Instructions}
317
318 The package file \file{ltxutil.sty}
319 is generated from this file, \file{ltxutil.dtx},
320 using the {\sc docstrip} facility of \LaTeX
321 via |tex ltxutil.ins|.
322 The typeset documentation that you are now reading is generated from
323 the same file by typesetting it with \LaTeX\ or pdftex
324 via |latex ltxutil.dtx| or |pdflatex ltxutil.dtx|.
325
326 \subsection{Build Instructions}
327
328 You may bootstrap this suite of files solely from \file{ltxutil.dtx}.
329 Prepare by installing \LaTeXe\ (and either tex or pdftex) on your computer,
330 then carry out the following steps:
331 \begin{enumerate}
332 \item
333 Within an otherwise empty directory,
334 typeset \file{ltxutil.dtx} with \LaTeX\ or pdflatex;
335 you will obtain the typeset documentation you are now reading,
336 along with
337 the installer \file{ltxutil.ins},
338 and the file \file{00readme.txt}.
339
340 Note: you will have to run \LaTeX\ twice, then \file{makeindex}, then
341 \LaTeX\ again in order to obtain a valid index and table of contents.
342 \item
343 Now typeset \file{ltxutil.ins},
344 thereby generating the package file \file{ltxutil.sty}.
345 \item
346 Install \classname{ltxutil.sty}
347 by moving it to a location
348 in your filesystem where they will be found by \LaTeX.
349 \end{enumerate}
350 \end{filecontents*}
351 % \end{macrocode}
352 %
353 % \subsection{The Document Body}
354 %
355 % Here is the document body, containing only a
356 % \cmd\DocInput\ directive---referring to this very file.
357 % This very cute self-reference is a common \classname{ltxdoc} idiom.
358 % \begin{macrocode}
359 \begin{document}%
360 \expandafter\DocInput\expandafter{\jobname.dtx}%
361 % ^^A\PrintChanges
362 \end{document}
363 % \end{macrocode}
364 %
365 % \begin{macrocode}
366 %</doc>
367 % \end{macrocode}
368 %
369 % \section{Using this package}
370 % Once this package is installed on your filesystem, you can employ it in
371 % adding functionality to \LaTeX\ by invoking it in your document or document class.
372 %
373 % \subsection{Invoking the package}
374 % In your document, you can simply call it up in your preamble:
375 % \begin{verbatim}
376 %\documentclass{book}%
377 %\usepackage{ltxutil}%
378 %\begin{document}
379 %<your document here>
380 %\end{document}
381 % \end{verbatim}
382 % However, the preferred way is to invoke this package from within your
383 % customized document class:
384 % \begin{verbatim}
385 %\NeedsTeXFormat{LaTeX2e}[1995/12/01]%
386 %\ProvidesClass{myclass}%
387 %\RequirePackage{ltxutil}%
388 %\LoadClass{book}%
389 %<class customization commands>
390 %\endinput
391 % \end{verbatim}
392 %
393 % Once loaded, the package gives you acccess to certain procedures,
394 % usually to be invoked by a \LaTeX\ command or environment, but not at the document level.
395 %
396 %
397 % \section{Compatability with \LaTeX's Required Packages}
398 % Certain packages, usually ones written by members of the
399 % \LaTeX\ Project itself, have been designated ``required'' and
400 % are distributed as part of standard \LaTeX.
401 % These packages have been placed in a priviledged position
402 % vis \'a vis the \LaTeX\ kernel in that they override the definitions of certain kernel macros.
403 %
404 % The \classname{ltxutil} package will be incompatible with any package that
405 % redefines any of the kernel macros that \classname{ltxutil} patches---if that
406 % package is loaded \emph{after} \classname{ltxutil}. This means that for
407 % greatest compatability, \classname{ltxutil} should be loaded \emph{after},
408 % say, \classname{ftnright}, which overwrites \LaTeX's kernel
409 % procedures \cmd\@outputdblcol, \cmd\@startcolumn, and \cmd\@makecol.
410 %
411 % Hereinafter follows some notes on specific \LaTeX\ packages.
412 %
413 % \subsection{array}
414 % This package alters the way tabular environments are done,
415 % therefore it could run afoul of the \LaTeX\ ``required'' package \classname{array} or any
416 % package that calls for it to be loaded.
417 % However, this package has provisions for remaining compatible with \classname{array}.
418 % So long as the version of \classname{array} that is used with this package has the appropriate
419 % meanings for the procedures it overwrites, all should be well.
420 %
421 % \subsection{longtable}
422 % David Carlisle's \classname{longtable} package modifies both the \LaTeX\ kernel and the
423 % \classname{array} package. This package must therefore alter \cmd\LT@array.
424 % For now, that job is handled by \classname{ltxgrid}.
425 %
426 %
427 %\StopEventually{}
428 %
429 % \section{Implementation of package}
430 %
431 % Special acknowledgment: this package uses concepts pioneered
432 % and first realized by William Baxter (mailto:[email protected])
433 % in his SuperScript line of commercial typesetting tools, and
434 % which are used here with his permission.
435 %
436 % \subsection{Beginning of the \file{ltxutil} {\sc docstrip} module}
437 % \begin{macrocode}
438 %<*ltxutil>
439 \def\package@name{ltxutil}%
440 \expandafter\PackageInfo\expandafter{\package@name}{%
441 Utility macros for \protect\LaTeXe,
442 by A. Ogawa ([email protected])%
443 }%
444 %</ltxutil>
445 % \end{macrocode}
446 %
447 % \subsection{Banner}%
448 % Credit where due.
449 % \begin{macrocode}
450 %<*ltxutil-krn>
451 \typeout{%
452 ltxutil: portions licensed from W. E. Baxter ([email protected])%
453 }%
454 % \end{macrocode}
455 %
456 % \subsection{Errors and warnings}
457 %
458 % \begin{macro}{\class@err}
459 % \begin{macro}{\class@warn}
460 % \begin{macro}{\class@info}
461 % A few shorthands for Class messages.
462 % Your document class should define \cmd\class@name.
463 % \begin{macrocode}
464 \def\class@err#1{\ClassError{\class@name}{#1}\@eha}%
465 \def\class@warn#1{\ClassWarningNoLine{\class@name}{#1}}%
466 \def\class@info#1{\ClassInfo{\class@name}{#1}}%
467 \def\obsolete@command#1{%
468 \class@warn@end{Command \string#1\space is obsolete.^^JPlease remove from your document}%
469 \global\let#1\@empty
470 #1%
471 }%
472 \def\replace@command#1#2{%
473 \class@warn@end{Command \string#1\space is obsolete;^^JUse \string#2\space instead}%
474 \global\let#1#2%
475 #1%
476 }%
477 \def\replace@environment#1#2{%
478 \class@warn@end{Environment #1 is obsolete;^^JUse #2 instead}%
479 \glet@environment{#1}{#2}%
480 \@nameuse{#1}%
481 }%
482 \def\incompatible@package#1{%
483 \@ifpackageloaded{#1}{%
484 \def\@tempa{I cannot continue. You must remove the \string\usepackage\ statement that caused that package to be loaded.}%
485 \ClassError{\class@name}{The #1 package cannot be used with \class@name}%
486 \@tempa\stop
487 }{%
488 \class@info{#1 was not loaded (OK!)}%
489 }%
490 }%
491 \def\class@warn@end#1{%
492 \gappdef\class@enddocumenthook{\class@warn{#1}}%
493 }%
494 \AtEndOfClass{%
495 \@ifxundefined\class@name{\def\class@name{Generic Class}}{}%
496 }%
497 % \end{macrocode}
498 % \end{macro}
499 % \end{macro}
500 % \end{macro}
501 %
502 % \subsection{New Tools}%
503 %
504 % \begin{macro}{\t@}
505 % \begin{macrocode}
506 \def\t@{to}%
507 % \end{macrocode}
508 % \end{macro}
509 %
510 % \begin{macro}{\dimen@iii}
511 % \begin{macrocode}
512 \dimendef\dimen@iii\thr@@
513 % \end{macrocode}
514 % \end{macro}
515 %
516 % \begin{macro}{\halignt@}
517 % \begin{macrocode}
518 \def\halignt@{\halign\t@}%
519 % \end{macrocode}
520 % \end{macro}
521 %
522 % \begin{macro}{\f@ur}
523 % Analogous to \cmd\@ne, \cmd\tw@, and \cmd\thr@@.
524 % \begin{macrocode}
525 \chardef\f@ur=4\relax
526 \chardef\cat@letter=11\relax
527 \chardef\other=12\relax
528 % \end{macrocode}
529 % \end{macro}
530 %
531 % \begin{macro}{\let@environment}
532 % \begin{macro}{\glet@environment}
533 % The directive \cmd\let@environment\ takes care of a common programming
534 % idiom whereby one environment is made a synonym for another.
535 % \begin{macrocode}
536 \def\let@environment#1#2{%
537 \expandafter\let
538 \csname#1\expandafter\endcsname\csname#2\endcsname
539 \expandafter\let
540 \csname end#1\expandafter\endcsname\csname end#2\endcsname
541 }%
542 \def\glet@environment#1#2{%
543 \global\expandafter\let
544 \csname#1\expandafter\endcsname\csname#2\endcsname
545 \global\expandafter\let
546 \csname end#1\expandafter\endcsname\csname end#2\endcsname
547 }%
548 % \end{macrocode}
549 % \end{macro}
550 % \end{macro}
551 %
552 % \begin{macro}{\tracingplain}
553 % The command \cmd\tracingplain\ causes \TeX's tracing parameters to
554 % return to the values set by default. This command is sometimes
555 % useful when you have said \cmd\tracingall\ somewhere and want to
556 % restore.
557 % The \cmd\traceoutput\ command causes \cmd\tracingoutput\ diagnostics
558 % upon \cmd\shipout.
559 % \begin{macrocode}
560 \newcommand\tracingplain{%
561 \tracingonline\z@\tracingcommands\z@\tracingstats\z@
562 \tracingpages\z@\tracingoutput\z@\tracinglostchars\@ne
563 \tracingmacros\z@\tracingparagraphs\z@\tracingrestores\z@
564 \showboxbreadth5\showboxdepth3\relax %\errorstopmode
565 }%
566 \newcommand\traceoutput{%
567 \appdef\@resetactivechars{\showoutput}%
568 }%
569 % \end{macrocode}
570 % \end{macro}
571 %
572 % \begin{macro}{\say}
573 % \begin{macro}{\saythe}
574 % The commands \cmd\say\ and \cmd\saythe\ cause diagnostic messages in the
575 % \TeX\ log that give the value of a control sequence name or a register
576 % respectively.
577 % \begin{macrocode}
578 \newcommand\say[1]{\typeout{<\noexpand#1=\meaning#1>}}%
579 \newcommand\saythe[1]{\typeout{<\noexpand#1=\the#1>}}%
580 % \end{macrocode}
581 % \end{macro}
582 % \end{macro}
583 %
584 % \begin{macro}{\fullinterlineskip}
585 % Resets the \cmd\prevdepth\ so that the full amount of \cmd\baselineskip\ glue will be inserted by
586 % the \cmd\baselinesklip\ mechanism.
587 % Can be invoked just after a \cmd\hrule\ to undo its default suppression of base line skip.
588 % \begin{macrocode}
589 \def\fullinterlineskip{\prevdepth\z@}%
590 % \end{macrocode}
591 % \end{macro}
592 %
593 % \begin{macro}{\count@i}
594 % \begin{macro}{\count@ii}
595 %
596 % \begin{macrocode}
597 \countdef\count@i\@ne
598 \countdef\count@ii\tw@
599 % \end{macrocode}
600 % \end{macro}
601 % \end{macro}
602 %
603 %
604 % \subsection{Boolean Control}%
605 % We introduce just enough of the Boolean calculus for \TeX.
606 % Alan Jeffrey was the pioneer here, with an article in TUGboat
607 % (Vol. 11, No. 2, page 237).
608 % This implementation owes a debt to
609 % William Baxter ([email protected]).
610 % See articles by Baxter and Ogawa in the proceedings of the
611 % 1994 TUG meeting, TUGboat Vol.~15, No.~3.
612 %
613 % \begin{macro}{\prepdef}
614 % \begin{macro}{\appdef}
615 % \begin{macro}{\gappdef}
616 %
617 % Provide the capability of performing head- and tail patches.
618 % The procedure \cmd\prepdef\ prepends to the given macro
619 % the tokens specified in its second argument.
620 % Likewise for \cmd\appdef, except that it appends.
621 % Note that the first 10 toks registers are utility registers,
622 % and we simply make a control sequence name, \cmd\toks@ii, for one of
623 % them.
624 % \begin{macrocode}
625 \long\def\prepdef#1#2{%
626 \@ifxundefined#1{\toks@{}}{\toks@\expandafter{#1}}%
627 \toks@ii{#2}%
628 \edef#1{\the\toks@ii\the\toks@}%
629 }%
630 \long\def\appdef#1#2{%
631 \@ifxundefined#1{\toks@{}}{\toks@\expandafter{#1}}%
632 \toks@ii{#2}%
633 \edef#1{\the\toks@\the\toks@ii}%
634 }%
635 \long\def\gappdef#1#2{%
636 \@ifxundefined#1{\toks@{}}{\toks@\expandafter{#1}}%
637 \toks@ii{#2}%
638 \global\edef#1{\the\toks@\the\toks@ii}%
639 }%
640 \long\def\appdef@val#1#2{%
641 \appdef#1{{#2}}%
642 }%
643 \long\def\appdef@e#1#2{%
644 \expandafter\appdef
645 \expandafter#1%
646 \expandafter{#2}%
647 }%
648 \long\def\appdef@eval#1#2{%
649 \expandafter\appdef@val
650 \expandafter#1%
651 \expandafter{#2}%
652 }%
653 \toksdef\toks@ii=\tw@
654 % \end{macrocode}
655 % \end{macro}
656 % \end{macro}
657 % \end{macro}
658 %
659 % \begin{macro}{\@ifxundefined}
660 % \begin{macro}{\@ifnotrelax}
661 % \begin{macro}{\@argswap}
662 % \begin{macro}{\@argswap@val}
663 %
664 % Certain utility procedures use \cmd\@ifxundefined,
665 % which is defined here in terms of \cmd\@ifx.
666 % Others use \cmd\@ifnotrelax, namely when
667 % the control sequence name is manufactured by
668 % the use of \cmd\csname.
669 %
670 % The procedures \cmd\@argswap and \cmd\@argswap@val
671 % are used to facilitate control of expansion.
672 %
673 % \begin{macrocode}
674 \long\def\@ifxundefined#1{\@ifx{\undefined#1}}%
675 \long\def\@ifnotrelax#1#2#3{\@ifx{\relax#1}{#3}{#2}}%
676 \long\def\@argswap#1#2{#2#1}%
677 \long\def\@argswap@val#1#2{#2{#1}}%
678 \def\@ifxundefined@cs#1{\expandafter\@ifx\expandafter{\csname#1\endcsname\relax}}%
679 % \end{macrocode}
680 % \end{macro}
681 % \end{macro}
682 % \end{macro}
683 % \end{macro}
684 %
685 % \begin{macro}{\rvtx@ifformat@geq}
686 % Some changes in the \LaTeX{} kernel requires us to conditionally
687 % define some macros depending on the version of the kernel.
688 % \cmd\rvtx@ifformat@geq{} will check if the release date of the
689 % currently-running \LaTeXe{} kernel is greater or equal to the
690 % argument (the argument should be in the format \texttt{yyyy-mm-dd}).
691 % \changes{4.2d}{2020/09/17}{(PHO) Add \cs{rvtx@ifformat@geq} (from 4.2).}%
692 % \begin{macrocode}
693 \ifx\IfFormatAtLeastTF\undefined
694 \def\rvtx@ifformat@geq{\@ifl@t@r\fmtversion}%
695 \else
696 \let\rvtx@ifformat@geq\IfFormatAtLeastTF
697 \fi
698 % \end{macrocode}
699 % \end{macro}
700 %
701 % \begin{macro}{\@boolean}
702 % \begin{macro}{\@boole@def}
703 % In order to define \cmd\@ifx, we first must create the
704 % ``defining word'' (term taken form our Forth vocabulary)
705 % \cmd\@boole@def, which employs \cmd\@boolean\ to do its job.
706 % \begin{macrocode}
707 \def\@boolean#1#2{%
708 \long\def#1{%
709 #2% \if<something>
710 \expandafter\true@sw
711 \else
712 \expandafter\false@sw
713 \fi
714 }%
715 }%
716 \def\@boole@def#1#{\@boolean{#1}}% Implicit #2
717 % \end{macrocode}
718 % \end{macro}
719 % \end{macro}
720 %
721 % \begin{macro}{\@booleantrue}
722 % \begin{macro}{\@booleanfalse}
723 % The procedures \cmd\@booleantrue\ and
724 % \cmd\@booleanfalse\ are assignment operators
725 % for Boolean flags.
726 % \begin{macrocode}
727 \def\@booleantrue#1{\let#1\true@sw}%
728 \def\@booleanfalse#1{\let#1\false@sw}%
729 % \end{macrocode}
730 % \end{macro}
731 % \end{macro}
732 %
733 % \begin{macro}{\@ifx}
734 % \begin{macro}{\@ifx@empty}
735 % \begin{macro}{\@if@empty}
736 % \begin{macro}{\@ifcat}%
737 % \begin{macro}{\@ifdim}%
738 % \begin{macro}{\@ifeof}%
739 % \begin{macro}{\@ifhbox}%
740 % \begin{macro}{\@ifhmode}%
741 % \begin{macro}{\@ifinner}%
742 % \begin{macro}{\@ifmmode}%
743 % \begin{macro}{\@ifnum}%
744 % \begin{macro}{\@ifodd}%
745 % \begin{macro}{\@ifvbox}%
746 % \begin{macro}{\@ifvmode}%
747 % \begin{macro}{\@ifvoid}%
748 % We can now invoke the defining word to create
749 % the procedures \cmd\@ifx\ and friends.
750 %
751 % Compatability Note: earlier versions of this package
752 % defined a procedure \cmd\@ifempty. However, for compatability with AMS\LaTeX,
753 % we must avoid the following three names:
754 % \cmd\@ifempty, \cmd\@xifempty, and \cmd\@ifnotempty.
755 %
756 % \begin{macrocode}
757 \@boole@def\@ifx#1{\ifx#1}%
758 \@boole@def\@ifx@empty#1{\ifx\@empty#1}%
759 \@boole@def\@if@empty#1{\if!#1!}%
760 %\@boole@def\@if@sw#1{\csname if#1\endcsname}%
761 \def\@if@sw#1#2{#1\expandafter\true@sw\else\expandafter\false@sw#2}%
762 \@boole@def\@ifdim#1{\ifdim#1}%
763 \@boole@def\@ifeof#1{\ifeof#1}%
764 \@boole@def\@ifhbox#1{\ifhbox#1}%
765 \@boole@def\@ifhmode{\ifhmode}%
766 \@boole@def\@ifinner{\ifinner}%
767 \@boole@def\@ifmmode{\ifmmode}%
768 \@boole@def\@ifnum#1{\ifnum#1}%
769 \@boole@def\@ifodd#1{\ifodd#1}%
770 \@boole@def\@ifvbox#1{\ifvbox#1}%
771 \@boole@def\@ifvmode{\ifvmode}%
772 \@boole@def\@ifvoid#1{\ifvoid#1}%
773 % \end{macrocode}
774 % \end{macro}
775 % \end{macro}
776 % \end{macro}
777 % \end{macro}
778 % \end{macro}
779 % \end{macro}
780 % \end{macro}
781 % \end{macro}
782 % \end{macro}
783 % \end{macro}
784 % \end{macro}
785 % \end{macro}
786 % \end{macro}
787 % \end{macro}
788 % \end{macro}
789 %
790 % \begin{macro}{\true@sw}
791 % \begin{macro}{\false@sw}
792 %
793 % Note that when a Boolean operator expands, it
794 % employs two macros that act as selectors, defined here.
795 %
796 % \begin{macrocode}
797 \long\def\true@sw#1#2{#1}%
798 \long\def\false@sw#1#2{#2}%
799 % \end{macrocode}
800 % \end{macro}
801 % \end{macro}
802 %
803 % \begin{macro}{\loopuntil}
804 % \begin{macro}{\loopwhile}
805 %
806 % Loop control using the Boolean idiom.
807 % Superior to \cmd\loop\dots\cmd\repeat\ because these can be nested.
808 % The tail of the argument must have a Boolean predicate.
809 %
810 % \begin{macrocode}
811 \long\def\loopuntil#1{#1{}{\loopuntil{#1}}}%
812 \long\def\loopwhile#1{#1{\loopwhile{#1}}{}}%
813 % \end{macrocode}
814 % \end{macro}
815 % \end{macro}
816 %
817 % \begin{macro}{\@provide}
818 %
819 % A defining word that refuses to clobber a prior meaning.
820 %
821 % \begin{macrocode}
822 \def\@provide#1{%
823 \@ifx{\undefined#1}{\true@sw}{\@ifx{\relax#1}{\true@sw}{\false@sw}}%
824 {\def#1}{\def\j@nk}%
825 }%
826 % \end{macrocode}
827 % \end{macro}
828 %
829 %
830 % \subsection{Begin Document Structure}
831 % The standard \LaTeX\ mechanism \cmd\AtBeginDocument\
832 % is inadequate because the \cmd\vsize\ is bound much too early.
833 % We supply here a mechanism whereby decisions about the
834 % page layout can be deferred until \cmd\AtBeginDocument\ time.
835 %
836 % The problem we are working around is that the \cmd\AtBeginDocument\
837 % hook in \cmd\document\ appears long after the calculation of
838 % \cmd\vsize\ and \cmd\hsize, that is, \LaTeX\ provides no mechanism
839 % for deferring the decision about the page grid until \cmd\AtBeginDocument\ time.
840 % We fix things by prepending a hook at the very beginning of \cmd\document.
841 %
842 % \begin{macro}{\document}
843 % We begin by installing hooks into \cmd\document\ that
844 % we will manage ourselves.
845 %
846 % The 2020-10-01 \LaTeX{} release got a new hook management system and
847 % several new hooks (several previously provided by \textsf{etoolbox}).
848 % The one we want here is \texttt{begindocument/before}, the first thing
849 % executed by \cmd\document{}, right after ending the group started by
850 % \cmd\begin{}.
851 %
852 % Thus, if the \LaTeX{} kernel date is 2020-10-01 we just add to that
853 % hook, otherwise resort to the old method, patching \cmd\document:
854 % end the group started by \cmd\begin, apply our hook, and
855 % conclude our shenanigans by absorbing
856 % the first token of the expansion of \cmd\document, which
857 % we assume to be \cmd\endgroup{} (true until the aforementioned release).
858 % \changes{4.2d}{2020/09/17}{(PHO) Use \LaTeX's hook management system, if possible (from 4.2).}%
859 % \begin{macrocode}
860 \rvtx@ifformat@geq{2020-10-01}%
861 {%
862 \AddToHook{begindocument/before}{%
863 \init@documenthook
864 \set@typesize@hook
865 \normalsize
866 \set@pica@hook
867 }%
868 }{%
869 \prepdef\document{%
870 \endgroup
871 \init@documenthook
872 \set@typesize@hook
873 \normalsize
874 \set@pica@hook
875 \true@sw{}%
876 }%
877 }
878 % \end{macrocode}
879 % \end{macro}
880 %
881 % \begin{macro}{\class@documenthook}
882 % \begin{macro}{\class@enddocumenthook}
883 % We install the first \cmd\AtBeginDocument\ hook, namely the
884 % procedure \cmd\class@documenthook. Within the document class,
885 % we will use this hook exclusively, so as to avoid interference from other packages.
886 % Similarly with \cmd\class@enddocumenthook, installed via \cmd\AtEndDocument.
887 %
888 % A document class using this package should do as this package does and
889 % just say, \cmd\appdef\cmd\class@documenthook\ and \cmd\appdef\cmd\class@enddocumenthook\
890 % instead of \cmd\AtBeginDocument\ and \cmd\AtEndDocument.
891 % \begin{macrocode}
892 \def\init@documenthook{}%
893 \AtBeginDocument{%
894 \class@documenthook
895 }%
896 \AtEndDocument{%
897 \class@enddocumenthook
898 }%
899 \def\class@documenthook{}%
900 \def\class@enddocumenthook{}%
901 % \end{macrocode}
902 % \end{macro}
903 % \end{macro}
904 %
905 % \begin{macro}{\set@typesize@hook}
906 % \begin{macro}{\set@pica@hook}
907 % The macros \cmd\set@typesize@hook\ and \cmd\set@pica@hook\ provide everything we need.
908 % To use, simply \cmd\appdef\ your tokens to the appropriate hook.
909 % \begin{macrocode}
910 \def\set@typesize@hook{}%
911 \def\set@pica@hook{}%
912 % \end{macrocode}
913 % \end{macro}
914 % \end{macro}
915 %
916 % \begin{macro}{\enddocument}
917 % \begin{macro}{\check@aux}
918 % \begin{macro}{\do@check@aux}
919 % The standard \LaTeX\ \enve{document} processing is a potential problem,
920 % particularly when the output routine has been changed by \classname{ltxgrid}.
921 % We separate out the procedure that checks the auxiliary file at the end of
922 % the job so that later it can be called from the safety of the output
923 % routine.
924 % We will do this to ensure that the \cmd\@mainaux\ stream is not closed until
925 % the last page of the job is shipped out, and that can only be done by coordinating
926 % with the output routine.
927 %
928 % \changes{4.2d}{2020/09/17}{(PHO) Only redefine \cs{enddocument} in older versions.}%
929 % This approach, however, will only be done for older versions of the
930 % \LaTeX{} kernel:
931 % \begin{macrocode}
932 \rvtx@ifformat@geq{2020-10-01}{%
933 % <definitions for newer LaTeX later>
934 }{%
935 % <definitions for older LaTeX>
936 \def\enddocument{%
937 \@enddocumenthook
938 \@checkend{document}%
939 \clear@document
940 \check@aux
941 \deadcycles\z@
942 \@@end
943 }%
944 \def\clear@document{\clearpage}%
945 \def\check@aux{\do@check@aux}%
946 \def\do@check@aux{%
947 \@if@sw\if@filesw\fi{%
948 \immediate\closeout\@mainaux
949 \let\@setckpt\@gobbletwo
950 \let\@newl@bel\@testdef
951 \@tempswafalse
952 \makeatletter
953 \input\jobname.aux\relax
954 }{}%
955 \@dofilelist
956 \@ifdim{\font@submax >\fontsubfuzz\relax}{%
957 \@font@warning{%
958 Size substitutions with differences\MessageBreak
959 up to \font@submax\space have occured.\@gobbletwo
960 }%
961 }{}%
962 \@defaultsubs
963 \@refundefined
964 \@if@sw\if@filesw\fi{%
965 \@ifx{\@multiplelabels\relax}{%
966 \@if@sw\if@tempswa\fi{%
967 \@latex@warning@no@line{%
968 Label(s) may have changed.
969 Rerun to get cross-references right%
970 }%
971 }{}%
972 }{%
973 \@multiplelabels
974 }%
975 }{}%
976 }%
977 }
978 % \end{macrocode}
979 % \end{macro}
980 % \end{macro}
981 % \end{macro}
982 %
983 % \changes{4.2d}{2020/09/17}{(PHO) Patch \cs{enddocument} at runtime in newer versions.}%
984 % \begin{macro}{\rvtx@enddocument@patch}
985 % For newer \LaTeX{} we'll try to be a bit more future-proof
986 % (no miracle though). The code for \cmd\enddocument{}
987 % (in pre-2020-10-01 \LaTeX) is roughly:
988 % \begin{verbatim}
989 % \def\enddocument{%
990 % <hooks and bookkeeping>
991 % \clearpage
992 % <read main .aux and final checks>
993 % \@@end
994 % }
995 % \end{verbatim}
996 % and the patches above replace the \cmd\clearpage{} by its own
997 % \cmd\clear@document, and \verb|<read main .aux and final checks>| by
998 % \cmd\do@check@aux, which it can later control the timing.
999 %
1000 % Now we will apply the same changes, but this time without redefining
1001 % \cmd\enddocument: we will instead replace tokens on-the-fly, when
1002 % \cmd\enddocument{} is expanded. This will grant us a slightly safer
1003 % approach that won't depend so much on the internals of
1004 % \cmd\enddocument.
1005 %
1006 % This entire patch should work with the previous definition of
1007 % \cmd\enddocument{} as well (except it cannot be used in the hook),
1008 % but for now leave previous versions untouched.
1009 %
1010 % The entire patching will reside in the \texttt{enddocument} hook:
1011 % \begin{macrocode}
1012 \rvtx@ifformat@geq{2020-10-01}{%
1013 \AddToHook{enddocument}{\rvtx@enddocument@patch{}}%
1014 }{}
1015 % \end{macrocode}
1016 %
1017 % This macro will be executed after \cmd\enddocument{} has expanded,
1018 % so all its tokens are now exposed. Here we will assume that
1019 % \cmd\enddocument{} contains the tokens \verb|\@checkend{document}|
1020 % and \cmd\endgroup, and use them as delimiters:
1021 % \begin{macrocode}
1022 \protected\long\def\rvtx@enddocument@patch#1#2\@checkend#3{%
1023 \begingroup
1024 \edef\x{\detokenize{#3}}%
1025 \edef\y{\detokenize{document}}%
1026 \expandafter\endgroup
1027 \ifx\x\y
1028 \expandafter\rvtx@enddocument@patch@end
1029 \else
1030 \expandafter\rvtx@enddocument@patch@more
1031 \fi
1032 {#1#2}{#3}}
1033 \def\rvtx@enddocument@patch@more#1#2{%
1034 \rvtx@enddocument@patch{#1\@checkend{#2}}}
1035 % \end{macrocode}
1036 %
1037 % When the \verb|\@checkend{document}| is reached, use \cmd\clearpage{}
1038 % and \cmd\enddocument{} as delimiters for the
1039 % \verb|<read main .aux and final checks>| part, and save it in
1040 % \cmd\do@check@aux{}:
1041 % \begin{macrocode}
1042 \long\def\rvtx@enddocument@patch@end#1#2\clearpage#3\endgroup{%
1043 \def\do@check@aux{#3\endgroup}%
1044 % \end{macrocode}
1045 % Then execute the code consumed in the previous step:
1046 % \begin{macrocode}
1047 #1%
1048 \@checkend{#2}%
1049 % \end{macrocode}
1050 % Do \cmd\clear@document{} instead of \cmd\clearpage{} and
1051 % \cmd\check@aux{} instead of the code grabbed.
1052 % \begin{macrocode}
1053 \clear@document
1054 \check@aux}
1055 \def\check@aux{\do@check@aux}%
1056 \def\clear@document{\clearpage}%
1057 % \end{macrocode}
1058 % \end{macro}
1059 %
1060 % \subsection{Type Tools}%
1061 %
1062 % \begin{macro}{\flushing}
1063 % Undoes \cmd\centering. Should also undo \cmd\raggedleft\ and \cmd\raggedright.
1064 % \begin{macrocode}
1065 \def\flushing{%
1066 \let\\\@normalcr
1067 \leftskip\z@skip
1068 \rightskip\z@skip
1069 \@rightskip\z@skip
1070 \parfillskip\@flushglue
1071 }%
1072 % \end{macrocode}
1073 % \end{macro}
1074 %
1075 %
1076 % \subsection{Display Math}%
1077 %
1078 % \begin{macro}{\eqnarray@LaTeX}
1079 % \begin{macro}{\eqnarray@fleqn@fixed}
1080 % Team \LaTeX\ has stated they will never repair Leslie's broken definition of \env{eqnarray}.
1081 % Let us be bold\dots.
1082 %
1083 % Note on \classname{hyperref} package compatability: that package overrides
1084 % \cmd\eqnarray\ by wrapping it up in a larger procedure, so its changes
1085 % are compatible with this package's changes.
1086 %
1087 % \begin{macrocode}
1088 \def\eqnarray@LaTeX{%
1089 \stepcounter{equation}%
1090 \def\@currentlabel{\p@equation\theequation}%
1091 \global\@eqnswtrue
1092 \m@th
1093 \global\@eqcnt\z@
1094 \tabskip\@centering
1095 \let\\\@eqncr
1096 $$\everycr{}\halign\t@\displaywidth\bgroup
1097 \hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel
1098 &\global\@eqcnt\@ne\hskip \tw@\arraycolsep \hfil${##}$\hfil
1099 &\global\@eqcnt\tw@ \hskip \tw@\arraycolsep
1100 $\displaystyle{##}$\hfil\tabskip\@centering
1101 &\global\@eqcnt\thr@@ \hb@xt@\z@\bgroup\hss##\egroup
1102 \tabskip\z@skip
1103 \cr
1104 }
1105 \long\def\eqnarray@fleqn@fixed{%
1106 \stepcounter{equation}\def\@currentlabel{\p@equation\theequation}%
1107 \global\@eqnswtrue\m@th\global\@eqcnt\z@
1108 \tabskip\mathindent
1109 \let\\=\@eqncr
1110 \setlength\abovedisplayskip{\topsep}%
1111 \ifvmode\addtolength\abovedisplayskip{\partopsep}\fi
1112 \addtolength\abovedisplayskip{\parskip}%
1113 \setlength\belowdisplayskip{\abovedisplayskip}%
1114 \setlength\belowdisplayshortskip{\abovedisplayskip}%
1115 \setlength\abovedisplayshortskip{\abovedisplayskip}%
1116 $$%
1117 \everycr{}%
1118 \halignt@\linewidth\bgroup
1119 \hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel
1120 &\global\@eqcnt\@ne
1121 \hskip\tw@\eqncolsep
1122 \hfil${{}##{}}$\hfil
1123 &\global\@eqcnt\tw@
1124 \hskip\tw@\eqncolsep
1125 $\displaystyle{##}$\hfil\tabskip\@centering
1126 &\global\@eqcnt\thr@@\hb@xt@\z@\bgroup\hss##\egroup
1127 \tabskip\z@skip
1128 \cr
1129 }%
1130 \@ifx{\eqnarray\eqnarray@LaTeX}{%
1131 \class@info{Repairing broken LaTeX eqnarray}%
1132 \let\eqnarray\eqnarray@fleqn@fixed
1133 \newlength\eqncolsep
1134 \setlength\eqncolsep\z@
1135 \let\eqnarray@LaTeX\relax
1136 \let\eqnarray@fleqn@fixed\relax
1137 }{}%
1138 \def\mathindent{\@centering}%
1139 \def\set@eqnarray@skips{}%
1140 % \end{macrocode}
1141 % \end{macro}
1142 % \end{macro}
1143 %
1144 %
1145 % \subsection{Footnotes}
1146 %
1147 % \changes{v4.0beta 4}{2000/04/10}
1148 % {New kernel fix. For bug 174}
1149 %
1150 % \begin{macro}{\footnote}
1151 % \begin{macro}{\footnotemark}
1152 % \begin{macro}{\@xfootnote}
1153 % \begin{macro}{\@xfootnotemark}
1154 % \begin{macro}{\@yfootnote}
1155 % We repair an error in the \LaTeX\ kernel (see \file{ltfloat.dtx}) involving footnotes.
1156 % The symptom is that the \cmd\footnotemark\ command does not work properly within a \env{minipage} environment.
1157 % The source of the problem is in the way the \cmd\footnotemark\ and \cmd\@xfootnotemark\ procedures are defined:
1158 % they do not share the method used by the \cmd\footnote\ and other procedures that allows a context switch to
1159 % change the way footnotes behave within a minipage environment.
1160 % This is a \LaTeX\ bug of long standing; this fix dates to 1987.
1161 %
1162 % While we are at it, we rewrite both the \cmd\footnote\ and \cmd\footnotemark\ procedures,
1163 % achieving a slightly cleaner separation of syntax and semantics.
1164 % Note that the \cmd\@footnotemark\ and \cmd\@footnotetext\ procedures are not altered here;
1165 % they continue as the methods of formatting the footnote mark and footnote text, respectively.
1166 %
1167 % A note about the context switch mentioned above:
1168 % the \env{minipage} environment executes the following in order to alter the way footnotes
1169 % behave:
1170 %\begin{verbatim}
1171 %\def\@mpfn{mpfootnote}%
1172 %\def\thempfn{\thempfootnote}%
1173 %\let\@footnotetext\@mpfootnotetext
1174 %\c@mpfootnote\z@
1175 %\end{verbatim}
1176 % This code changes the counter used in autonumbered footnotes, the choice of footnote marker,
1177 % and the procedure used on the footnote text. Changing the counter is needed because minipage
1178 % footnotes are in their own sequence, and the footnote marker is customarily different within
1179 % a minipage. The procedure that works on the footnote text must be different because the footnotes
1180 % are placed at the bottom of the minipage, not the bottom of the text column.
1181 %
1182 % Any procedure that establishes a minipage-like context (e.g., floats) can do the same.
1183 % \begin{macrocode}
1184 \def\footnote{%
1185 \@ifnextchar[\@xfootnote{\@yfootnote\@footnotetext}%
1186 }%
1187 \def\footnotemark{%
1188 \@ifnextchar[\@xfootnotemark{\@yfootnote}%
1189 }%
1190 \def\@xfootnote[#1]{%
1191 \@xfootnotemark[#1]%
1192 \@footnotetext
1193 }%
1194 \def\@xfootnotemark@ltx[#1]{%
1195 \begingroup
1196 \csname c@\@mpfn\endcsname #1\relax
1197 \unrestored@protected@xdef\@thefnmark{\thempfn}%
1198 \endgroup
1199 \H@@footnotemark
1200 }%
1201 \def\@yfootnote{%
1202 \stepcounter\@mpfn
1203 \protected@xdef\@thefnmark{\thempfn}%
1204 \H@@footnotemark
1205 }%
1206 % \end{macrocode}
1207 %
1208 % Note on \classname{hyperref} compatability:
1209 % In its ``Automated \LaTeX\ hypertext cross-references'',
1210 % the \classname{hyperref} package alters footnote processing,
1211 % thereby imperiling these fixes and necessiating defensive measures.
1212 %
1213 % The main thing \classname{hyperref} does is to take over the \cmd\@mpfootnotetext\ and
1214 % \cmd\@footnotetext\ procedures, feeding its own arguments to these macros.
1215 % It also rewrites \cmd\@footnotemark, making it a hyperlink.
1216 %
1217 % But at the same time, it attempts to turn off these changes during
1218 % \cmd\maketitle\ processing, necessitating rewriting \cmd\@xfootnotemark.
1219 % At this point it is on the slippery slope.
1220 %
1221 % We make ourself \classname{hyperref} friendly:
1222 % we give \classname{hyperref} what it needs, but avoid its change to
1223 % \cmd\@xfootnotemark.
1224 %
1225 % Any other package that rewrites \LaTeX's footnote macros will be incompatible
1226 % with this package.
1227 % \begin{macrocode}
1228 \appdef\class@documenthook{%
1229 \@ifxundefined\H@@footnotemark{%
1230 \let\H@@footnotemark\@footnotemark
1231 }{}%
1232 \let\@xfootnotemark\@xfootnotemark@ltx
1233 }%
1234 % \end{macrocode}
1235 %
1236 % Two thoughts about \classname{hyperref}: what for does it define \cmd\realfootnote?
1237 % Also: a document class that desires high hypertext capabilities might
1238 % well wish to reimplement \cmd\maketitle\ so that footnotes called out from there
1239 % are hypertext links: the \classname{hyperref} package's
1240 % ``Automated \LaTeX\ hypertext cross-references''
1241 % does not do any of this:
1242 %\begin{quotation}
1243 % But the special footnotes
1244 % in |\maketitle| are much too hard to deal with
1245 % properly. Let them revert to plain behaviour.
1246 %\end{quotation}
1247 % Note that the document class, in reimplementing \cmd\maketitle, must ensure
1248 % that the \classname{hyperref} package does not clobber its own definition!
1249 %
1250 % \end{macro}
1251 % \end{macro}
1252 % \end{macro}
1253 % \end{macro}
1254 % \end{macro}
1255 %
1256 % \begin{macro}{\@footnotetext}
1257 % \begin{macro}{\@mpfootnotetext}
1258 % \begin{macro}{\@tpfootnotetext}
1259 % \begin{macro}{\make@footnotetext}
1260 % \begin{macro}{\set@footnotewidth}
1261 % The two procedures \cmd\@footnotetext\ and \cmd\@mpfootnotetext\ share code.
1262 % We make that explicit here.
1263 %
1264 % Note that the procedure calling \cmd\make@footnotetext\ will open a group
1265 % with \cmd\bgroup\ which is then closed by \cmd\minipagefootnote@drop.
1266 %
1267 % Difference from \LaTeX: here we do not set \cmd\floatingpenalty\ to infinity.
1268 % Doing this must date back to a time when \LaTeX\ could not accomodate split insertions (footnotes).
1269 % I cannot think of any other reason to do have done this.
1270 % At any rate, with the \classname{ltxgrid} package, split insertions are specifically properly
1271 % taken care of, so we allow it.
1272 %
1273 % We provide the hook \cmd\set@footnotewidth\
1274 % that sets the footnote on a particular measure.
1275 % Some page grids are such as to set a footnote in a context where \cmd\columnwidth
1276 % is not the right parameter to use for the set width of a footnote.
1277 % In such a case, for the applicable scope, you should define
1278 % \cmd\set@footnotewidth\ to perform this job correctly.
1279 %
1280 % A procedure, \cmd\set@footnotewidth@ii, illustrates how to do this when in a two-column page grid.
1281 % In general, remember that footnotes, like all insertions (including floats),
1282 % are a step outside of the galley context, and all aspects of insertions need to be
1283 % properly handled, including the set width.
1284 % \begin{macrocode}
1285 \long\def\@footnotetext{%
1286 \insert\footins\bgroup
1287 \make@footnotetext
1288 }%
1289 \long\def\@mpfootnotetext{%
1290 \minipagefootnote@pick
1291 \make@footnotetext
1292 }%
1293 \def\make@footnotetext#1{%
1294 \reset@font\footnotesize
1295 \interlinepenalty\interfootnotelinepenalty
1296 \splittopskip\footnotesep
1297 \splitmaxdepth\dp\strutbox
1298 % \floatingpenalty\@MM
1299 \set@footnotewidth
1300 \@parboxrestore
1301 \protected@edef\@currentlabel{%
1302 \csname p@footnote\endcsname\@thefnmark
1303 }%
1304 \color@begingroup
1305 \@makefntext{%
1306 \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox
1307 }%
1308 \color@endgroup
1309 \minipagefootnote@drop
1310 }%
1311 \def\set@footnotewidth{%
1312 \hsize\columnwidth
1313 \linewidth\hsize
1314 }%
1315 \def\set@footnotewidth@ii{%
1316 \hsize\textwidth
1317 \advance\hsize\columnsep
1318 \divide\hsize\tw@
1319 \advance\hsize-\columnsep
1320 \linewidth\hsize
1321 }%
1322 % \end{macrocode}
1323 % \end{macro}
1324 % \end{macro}
1325 % \end{macro}
1326 % \end{macro}
1327 % \end{macro}
1328 %
1329 %
1330 % \subsection{Floats}
1331 %
1332 % \subsubsection{Usage notes}%
1333 % We extend the \LaTeX\ kernel for three purposes:
1334 % \begin{enumerate}
1335 %
1336 % \item
1337 % When the \cmd\footnote\ command is used within the
1338 % scope of a float, we do as \env{minipage} does.
1339 %
1340 % \item
1341 % We provide a mechanism to write floats out to an external
1342 % stream for temporary storage (deferred floats).
1343 %
1344 % \item
1345 % We provide mechanism for placing a float \texttt{here}
1346 % invariably, that is, floats are unfloated.
1347 % This mechanism is used to read the external stream mentioned above.
1348 %
1349 % \end{enumerate}
1350 %
1351 % To use these mechanisms, the document class should
1352 % define a float, say, \env{figure} as per usual, and in addition:
1353 % \begin{enumerate}
1354 %
1355 % \item
1356 % Optionally define an alternative, say \env{figure@write} as follows:
1357 % \begin{verbatim}
1358 %\newenvironment{figure@write}{%
1359 % \write@float{figure}%
1360 %}{%
1361 % \endwrite@float
1362 %}%
1363 % \end{verbatim}
1364 % That is, the alternative environment executes \cmd\write@float\
1365 % instead of \cmd\@float.
1366 % Note that this step is not needed if the float environment
1367 % is defined in the simple way of \file{classes.dtx}.
1368 % However, an environment like \env{longtable} will require it.
1369 %
1370 % \item
1371 % Install into \cmd\AtBeginDocument\ a call to \cmd\do@if@floats,
1372 % with the float name and an appropriate file extension as its arguments.
1373 % \begin{verbatim}
1374 %\AtBeginDocument{\do@if@floats{figure}{.fgx}}%
1375 % \end{verbatim}
1376 %
1377 % \item
1378 % Optionally define a text entity \cmd\figuresname\ that will
1379 % be the text of the head that is set over the
1380 % deferred floats.
1381 % If not defined, there will be no head.
1382 %
1383 % \item
1384 % Optionally define a user-level command to allow
1385 % the document to determine where the figures are printed out
1386 % (default is to print at end of document). E.g.,
1387 % \begin{verbatim}
1388 %\newcommand\printfigures{\print@float{figure}}%
1389 % \end{verbatim}
1390 % \item
1391 % Install into \cmd\appdef\cmd\class@enddocumenthook\ a call to \cmd\printfigures,
1392 % or, if the latter is not defined, as follows:
1393 % \begin{verbatim}
1394 %\appdef\class@enddocumenthook{\print@float{figure}}%
1395 % \end{verbatim}
1396 % Note that installing this command into \cmd\AtBeginDocument
1397 % is best done earlier than calls that assume the last page of
1398 % the document is at hand.
1399 %
1400 % \end{enumerate}
1401 %
1402 % \subsubsection{Robustifying fragile commands}%
1403 % Certain of \LaTeX's commands cannot be written out to a file or appear within a \cmd\mark\ command argument
1404 % because they do calculations during expansion.
1405 % We provide for a little help, but without changing the meanings of these commands.
1406 %
1407 % \begin{macro}{\addtocontents}
1408 %
1409 % \begin{macrocode}
1410 \def\addtocontents#1#2{%
1411 \protected@write\@auxout{%
1412 \let \label \@gobble \let \index \@gobble \let \glossary \@gobble
1413 \def\({\string\(}%
1414 \def\){\string\)}%
1415 \def\\{\string\\}%
1416 }{\string \@writefile {#1}{#2}}%
1417 }%
1418 % \end{macrocode}
1419 %
1420 % \end{macro}
1421 %
1422 % \subsubsection{Preparing for the \classname{hyperref package}}%
1423 %
1424 % \begin{macro}{\addcontentsline}
1425 % \begin{macro}{\contentsline}
1426 % The \classname{hyperref} package assumes that the \cmd\contentsline\ command will be given four arguments.
1427 % Therefore it cannot successfully process a \filename{.toc} file that had been written by standard \LaTeX.
1428 % We fix things up by always writing that fourth argument and by supplying a \cmd\contentsline\ command that
1429 % can read them.
1430 %
1431 % We also give the \cmd\newlabel\ command's second argument five tokens.
1432 %
1433 % This means that a document class that uses this package will itself have trouble taking over a \filename{.toc} file that was written by standard \LaTeX. Sigh.
1434 % \begin{macrocode}
1435 \def\addcontentsline#1#2#3{%
1436 \addtocontents{#1}{%
1437 \protect\contentsline{#2}{#3}{\thepage}{}%
1438 }%
1439 }%
1440 \def\contentsline#1#2#3#4{%
1441 \csname l@#1\endcsname{#2}{#3}%
1442 }%
1443 \def\label#1{%
1444 \@bsphack
1445 \protected@write\@auxout{}{%
1446 \string\newlabel{#1}{{\@currentlabel}{\thepage}{}{}{}}%
1447 }%
1448 \@esphack
1449 }%
1450 % \end{macrocode}
1451 %
1452 % \end{macro}
1453 % \end{macro}
1454 %
1455 % \subsubsection{Footnotes within floats, unfloating floats, float font}%
1456 %
1457 % \begin{macro}{\caption}
1458 % DPC: Er a bit of a hack, but seems best way of supporting normal
1459 % \LaTeX\ syntax at this point: If a caption is used below a table,
1460 % then put out the footnotes before the caption.
1461 % \changes{v4.0beta 2}{1999/06/20}
1462 % {Support the hack with \cs{prepdef}, and delay until \cs{AtBeginDocument} time,
1463 % since \classname{hyperref} clobbers \cs{caption}.}
1464 % \begin{macrocode}
1465 \appdef\class@documenthook{%
1466 \prepdef\caption{\minipagefootnote@here}%
1467 }%
1468 % \end{macrocode}
1469 %
1470 % Note on \classname{hyperref} compatability:
1471 % this change to the \cmd\caption\ command is compatible with the
1472 % ``Automated \LaTeX\ hypertext cross-references'' patches of
1473 % that package.
1474 %
1475 % All the same, I think Sebastian's changes to \cmd\caption\ and \cmd\@caption\
1476 % could bear with some improvement.
1477 % The following implementation requires knowing only the pattern part of the
1478 % \cmd\@caption\ macro:
1479 %\begin{verbatim}
1480 %\def\caption{%
1481 % \H@refstepcounter\@captype
1482 % \hyper@makecurrent{\@captype}%
1483 % \@dblarg{\H@caption\@captype}%
1484 %}%
1485 %\def\H@caption#1[#2]#3{%
1486 % \@caption{#1}[#2]{%
1487 % \ifHy@nesting
1488 % \hyper@@anchor{\@currentHref}{#3}%
1489 % \else
1490 % \hyper@@anchor{\@currentHref}{\relax}#3%
1491 % \fi
1492 % }%
1493 %}%
1494 %
1495 %\end{verbatim}
1496 %
1497 % \end{macro}
1498 %
1499 % \begin{macro}{\minipagefootnote@init}
1500 % \begin{macro}{\minipagefootnote@here}
1501 % \begin{macro}{\minipagefootnote@foot}
1502 % \begin{macro}{\minipagefootnote@pick}
1503 % \begin{macro}{\minipagefootnote@drop}
1504 % Procedure to deal with footnotes accumulated within a minipage environment.
1505 % These procedures encapsulate all uses of the \cmd\@mpfootins\ box.
1506 %
1507 %
1508 % Note: \cmd\minipagefootnote@here\ must \emph{not} be executed within the MVL!
1509 % \begin{macrocode}
1510 \def\minipagefootnote@init{%
1511 \setbox\@mpfootins\box\voidb@x
1512 }%
1513 \def\minipagefootnote@pick{%
1514 \global\setbox\@mpfootins\vbox\bgroup
1515 \unvbox\@mpfootins
1516 }%
1517 \def\minipagefootnote@drop{%
1518 \egroup
1519 }%
1520 \def\minipagefootnote@here{%
1521 \par
1522 \@ifvoid\@mpfootins{}{%
1523 \vskip\skip\@mpfootins
1524 \fullinterlineskip
1525 \@ifinner{%
1526 \vtop{\unvcopy\@mpfootins}%
1527 {\setbox\z@\lastbox}%
1528 }{}%
1529 \unvbox\@mpfootins
1530 }%
1531 }%
1532 \def\minipagefootnote@foot{%
1533 \@ifvoid\@mpfootins{}{%
1534 \insert\footins\bgroup\unvbox\@mpfootins\egroup
1535 }%
1536 }%
1537 \def\endminipage{%
1538 \par
1539 \unskip
1540 \minipagefootnote@here
1541 \@minipagefalse %% added 24 May 89
1542 \color@endgroup
1543 \egroup
1544 \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}%
1545 }%
1546 % \end{macrocode}
1547 % \end{macro}
1548 % \end{macro}
1549 % \end{macro}
1550 % \end{macro}
1551 % \end{macro}
1552 %
1553 % \begin{macro}{\floats@sw}
1554 % The Boolean \cmd\floats@sw\ signifies that floats are to be floated;
1555 % if false, that floats are to be deferred to the end of the document.
1556 % Note that the state of this Boolean is to be changed by
1557 % the document class in response to user-selected options.
1558 % Here we display model code that assigns a default value
1559 % at \cmd\AtBeginDocument\ time.
1560 % \begin{verbatim}
1561 %\AtBeginDocument{%
1562 % \@ifxundefined\floats@sw{\@booleantrue\floats@sw}{}%
1563 %}%
1564 % \end{verbatim}
1565 % \end{macro}
1566 %
1567 % \begin{macro}{\@xfloat}
1568 % \begin{macro}{\@mpmakefntext}
1569 % The float start-code is redefined to set up footnotes in the style of minipage.
1570 % Also, the \cmd\floats@sw\ Boolean informs us that floats are to be
1571 % all placed \texttt{here}.
1572 % Note that, to protect against the Boolean being undefined
1573 % at this late hour, we default it globally to true.
1574 %
1575 % \changes{v4.0beta 2}{1999/06/20}
1576 % {AO: Removed superfluous \cs{def}s, changed to using \cs{floats@sw} as the flag.
1577 % Also stopped using DPC's \cs{if@twocolumn} flag: using \cs{floats@sw} instead.
1578 % Also added \cs{par}\cs{vskip}\cs{z@skip} after the \cs{minipagefootnotes}
1579 % so that the float box would have zero depth like the kernel one.
1580 % }
1581 % \changes{v4.0beta 3}{1999/11/13}
1582 % {bug fix 110. Install hooks for endfloats processing}
1583 % \changes{v4.0beta 4}{2000/04/10}
1584 % {bug fix 127. Floats placed [h] to allow page breaks}
1585 % \changes{v4.0beta 4}{2000/05/19}
1586 % {bug fix 224. Hyperref compatability.}
1587 % \changes{v4.0beta 5}{2000/11/16}
1588 % {bug fix 221. Remove samepage command from @xfloat@prep: If the float can break over pages, we want better control.}
1589 %FIXME: why does hyperref override \cmd\@xfootnotenext?
1590 %
1591 % \begin{macrocode}
1592 \let\@xfloat@LaTeX\@xfloat
1593 \def\@xfloat#1[#2]{%
1594 \@xfloat@prep
1595 \@nameuse{fp@proc@#2}%
1596 \@ifxundefined\floats@sw{\global\@booleantrue\floats@sw}{}%
1597 \floats@sw{\@xfloat@LaTeX{#1}[#2]}{\@xfloat@anchored{#1}[]}%
1598 }%
1599 \def\@xfloat@prep{%
1600 \let\footnote\footnote@latex
1601 \def\@mpfn{mpfootnote}%
1602 \def\thempfn{\thempfootnote}%
1603 % \def\thefootnote{\thempfootnote}%
1604 \c@mpfootnote\z@
1605 \let\@footnotetext\@mpfootnotetext
1606 \let\H@@footnotetext\@mpfootnotetext
1607 \let\@makefntext\@mpmakefntext
1608 % \samepage
1609 }%
1610 \appdef\class@documenthook{%
1611 \let\footnote@latex\footnote
1612 }%
1613 %\def\fp@proc@h{\@booleanfalse\floats@sw}%
1614 %\def\fp@proc@H{\@booleanfalse\floats@sw}%
1615 \def\@xfloat@anchored#1[#2]{%
1616 \def\@captype{#1}%
1617 \begin@float@pagebreak
1618 %\vbox\bgroup
1619 \let\end@float\end@float@anchored
1620 \let\end@dblfloat\end@float@anchored
1621 % do as \@xfloat does:
1622 \hsize\columnwidth
1623 \@parboxrestore
1624 \@floatboxreset
1625 \minipagefootnote@init
1626 % \pagegrid@col\@ne % Klootch to avoid processing as a float
1627 }%
1628 \def\end@float@anchored{%
1629 \minipagefootnote@here
1630 \par\vskip\z@skip %% \par\vskip\z@ added 15 Dec 87
1631 %\egroup
1632 \par
1633 \end@float@pagebreak
1634 }%
1635 \def\begin@float@pagebreak{\par\addvspace\intextsep}%
1636 \def\end@float@pagebreak{\par\addvspace\intextsep}%
1637 \def\@mpmakefntext#1{%
1638 \parindent=1em
1639 \noindent
1640 \hb@xt@1em{\hss\@makefnmark}%
1641 #1%
1642 }%
1643 % \end{macrocode}
1644 % \end{macro}
1645 % \end{macro}
1646 %
1647 %
1648 % \subsubsection{Writing floats out to a file}%
1649 %
1650 % \begin{macro}{\do@if@floats}
1651 % The procedure \cmd\do@if@floats\ should be executed at
1652 % \cmd\AtBeginDocument\ time, and arranges to write out
1653 % the floats of the given class to a temporary file, to be
1654 % read back later (deferred floats),
1655 % given that \cmd\floats@sw\ is false.
1656 % Note that, to protect against the Boolean being undefined
1657 % at this late hour, we default it globally to true.
1658 % \begin{macrocode}
1659 \def\do@if@floats#1#2{%
1660 \@ifxundefined\floats@sw{\global\@booleantrue\floats@sw}{}%
1661 \floats@sw{}{%
1662 % \end{macrocode}
1663 % Open the stream to save out the document's floats of this class.
1664 % \begin{macrocode}
1665 \expandafter\newwrite
1666 \csname#1write\endcsname
1667 \expandafter\def
1668 \csname#1@stream\endcsname{\jobname#2}%
1669 \expandafter\immediate
1670 \expandafter\openout
1671 \csname#1write\endcsname
1672 \csname#1@stream\endcsname\relax
1673 % \end{macrocode}
1674 % Swap environments.
1675 % If the class writer has defined, e.g., \env{figure@write},
1676 % then we use this as the procedure to execute for writing
1677 % the float out to the external stream.
1678 % Otherwise, the replacement of \cmd\@float\ by \cmd\write@float\
1679 % should do the right thing for float environments defined
1680 % in the simple way of \classname{classes.dtx}.
1681 % \begin{macrocode}
1682 \@ifxundefined\@float@LaTeX{%
1683 \let\@float@LaTeX\@float
1684 \let\@dblfloat@LaTeX\@dblfloat
1685 \let\@float\write@float
1686 \let\@dblfloat\write@floats
1687 }{}%
1688 \let@environment{#1@float}{#1}%
1689 \let@environment{#1@floats}{#1*}%
1690 \@ifxundefined@cs{#1@write}{}{%
1691 \let@environment{#1}{#1@write}%
1692 }%
1693 }%
1694 }%
1695 % \end{macrocode}
1696 % \end{macro}
1697 %
1698 % \begin{macro}{\print@float}
1699 % The procedure \cmd\print@float\ prints out the
1700 % deferred floats.
1701 % \changes{v4.0beta 2}{1999/06/20}
1702 % {only execute if there really were floats of the given type}
1703 % \changes{v4.0beta 3}{1999/11/13}
1704 % {*-form mandates pagebreak at each float;
1705 % only print section head if there is something there.}
1706 % \changes{v4.0beta 4}{2000/05/23}
1707 % {Allow things to break over pages by setting array@default.}
1708 %
1709 % \begin{macrocode}
1710 \def\triggerpar{\leavevmode\@@par}%
1711 \def\oneapage{\def\begin@float@pagebreak{\newpage}\def\end@float@pagebreak{\newpage}}%
1712 \def\print@float#1#2{%
1713 \@ifxundefined@cs{#1write}{}{%
1714 \begingroup
1715 \@booleanfalse\floats@sw
1716 #2%
1717 \raggedbottom
1718 \def\array@default{v}% floats must
1719 \let\@float\@float@LaTeX
1720 \let\@dblfloat\@dblfloat@LaTeX
1721 \let\trigger@float@par\triggerpar
1722 \let@environment{#1}{#1@float}%
1723 \let@environment{#1*}{#1@floats}%
1724 \expandafter\prepdef\csname#1\endcsname{\trigger@float@par}%
1725 \expandafter\prepdef\csname#1*\endcsname{\trigger@float@par}%
1726 \@namedef{fps@#1}{h!}%
1727 \expandafter\immediate
1728 \expandafter\closeout
1729 \csname#1write\endcsname
1730 \everypar{%
1731 \global\let\trigger@float@par\relax
1732 \global\everypar{}\setbox\z@\lastbox
1733 \@ifxundefined@cs{#1sname}{}{%
1734 \begin@float@pagebreak
1735 \expandafter\section
1736 \expandafter*%
1737 \expandafter{%
1738 \csname#1sname\endcsname
1739 }%
1740 }%
1741 }%
1742 \input{\csname#1@stream\endcsname}%
1743 \endgroup
1744 \global\expandafter\let\csname#1write\endcsname\relax
1745 }%
1746 }%
1747 % \end{macrocode}
1748 % \end{macro}
1749 %
1750 % \begin{macro}{\write@float}
1751 % \begin{macro}{\write@floats}
1752 % \begin{macro}{\write@@float}
1753 % Handles the case where the name of the float is the same as
1754 % that of the stream. Note that
1755 % \env{longtable} does \emph{not} fit this case.
1756 % Note also: \cmd\write@float\ is \emph{not} a user-level environment
1757 % therefore it is properly not defined with \cmd\newenvironment.
1758 % \begin{macrocode}
1759 \def\write@float#1{\write@@float{#1}{#1}}%
1760 \def\endwrite@float{\@Esphack}%
1761 \def\write@floats#1{\write@@float{#1*}{#1}}%
1762 \def\endwrite@floats{\@Esphack}%
1763 % \end{macrocode}
1764 % \end{macro}
1765 %
1766 % \begin{macro}{\write@@float}
1767 % \changes{v4.0beta 2}{1999/06/20}
1768 % {AO: Fixed spurious \texttt{CR} and (return) characters in output file.
1769 % Also, if the document did not have the \cs{end}\texttt{figure} on a line of its own,
1770 % the macro wouldn't work. Fixed.}
1771 % \begin{macrocode}
1772 \def\write@@float#1#2{%
1773 \ifhmode
1774 \@bsphack
1775 \fi
1776 \chardef\@tempc\csname#2write\endcsname
1777 \toks@{\begin{#1}}%
1778 \def\@tempb{#1}%
1779 \expandafter\let\csname end#1\endcsname\endwrite@float
1780 \catcode`\^^M\active
1781 \@makeother\{\@makeother\}\@makeother\%
1782 \write@floatline
1783 }%
1784 % \end{macrocode}
1785 % \end{macro}
1786 % \end{macro}
1787 % \end{macro}
1788 %
1789 % \begin{macro}{\write@floatline}
1790 % \begin{macro}{\@write@floatline}
1791 % \begin{macro}{\float@end@tag}
1792 % The procedure \cmd\write@floatline\ only parses, and passes
1793 % its result to \cmd\@write@floatline, which
1794 % writes the line to output, then tests the line
1795 % for the \cmd\end\arg{float} tokens with
1796 % aid of the \cmd\float@end@tag\ procedure.
1797 % \begin{macrocode}
1798 \begingroup
1799 \catcode`\[\the\catcode`\{\catcode`\]\the\catcode`\}\@makeother\{\@makeother\}%
1800 \gdef\float@end@tag#1\end{#2}#3\@nul[%
1801 \def\@tempa[#2]%
1802 \@ifx[\@tempa\@tempb][\end[#2]][\write@floatline]%
1803 ]%
1804 \obeylines%
1805 \gdef\write@floatline#1^^M[%
1806 \begingroup%
1807 \newlinechar`\^^M%
1808 \toks@\expandafter[\the\toks@#1]\immediate\write\@tempc[\the\toks@]%
1809 \endgroup%
1810 \toks@[]%
1811 \float@end@tag#1\end{}\@nul%
1812 ]%
1813 \endgroup
1814 % \end{macrocode}
1815 % \end{macro}
1816 % \end{macro}
1817 % \end{macro}
1818 %
1819 %
1820 %
1821 % \subsection{Counters}
1822 % The following definitions override those of the \LaTeX\ kernel,
1823 % providing for a greater range of inputs.
1824 % \begin{macrocode}
1825 \def\@alph#1{\ifcase#1\or a\or b\or c\or d\else\@ialph{#1}\fi}
1826 % \end{macrocode}
1827 %
1828 % \begin{macrocode}
1829 \def\@ialph#1{\ifcase#1\or \or \or \or \or e\or f\or g\or h\or i\or j\or
1830 k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or
1831 y\or z\or aa\or bb\or cc\or dd\or ee\or ff\or gg\or hh\or ii\or jj\or
1832 kk\or ll\or mm\or nn\or oo\or pp\or qq\or rr\or ss\or tt\or uu\or
1833 vv\or ww\or xx\or yy\or zz\else\@ctrerr\fi}
1834 % \end{macrocode}
1835 %
1836 %
1837 % \subsection{Customization of Sections}%
1838 %
1839 % Patch the standard \LaTeX\ sectioning procedure to:
1840 %\begin{itemize}
1841 %\item
1842 % Allow a sectioning command to trigger the title page, or more generally
1843 % to recognize that it is the first object in the document,
1844 % so we headpatch \cmd\@startsection.
1845 %
1846 %\item
1847 % Allow a tail command in |#6| to uppercase the title, so we retain
1848 % DPC's braces.
1849 %
1850 %\item
1851 % Allow each type of sectioning command to format its number differently,
1852 % so we generalize \cmd\@seccntformat.
1853 %
1854 %\item
1855 % Allow each type of sectioning command to format its argument differently,
1856 % so we generalize \cmd\@hangfrom.
1857 %
1858 %\item
1859 % Allow the starred form of the command to
1860 % mark (the running head) and
1861 % make an entry in the TOC,
1862 % so we put \cmd\@ssect\ on the same footing as \cmd\@sect.
1863 %
1864 % Note that the tokens passed to the TOC now are \emph{not}
1865 % the optional argument of the command, but the required.
1866 % This means that the user can no longer use the former
1867 % to put variant content in to the TOC as the Manual says.
1868 %
1869 % Instead, the optional argument is used to put an alternative
1870 % title into the running headers, a better choice.
1871 %
1872 %\end{itemize}
1873 %
1874 % \begin{macro}{\@startsection}
1875 % Patch a head hook into the basic sectioning command.
1876 % Treat \cmd\@sect\ and \cmd\@ssect\ on an equal footing:
1877 % now their pattern parts are identical.
1878 % \begin{macrocode}
1879 \def\@startsection#1#2#3#4#5#6{%
1880 \@startsection@hook
1881 \if@noskipsec \leavevmode \fi
1882 \par
1883 \@tempskipa #4\relax
1884 \@afterindenttrue
1885 \ifdim \@tempskipa <\z@
1886 \@tempskipa -\@tempskipa \@afterindentfalse
1887 \fi
1888 \if@nobreak
1889 \everypar{}%
1890 \else
1891 \addpenalty\@secpenalty\addvspace\@tempskipa
1892 \fi
1893 \@ifstar
1894 {\@dblarg{\@ssect@ltx{#1}{#2}{#3}{#4}{#5}{#6}}}%
1895 {\@dblarg{\@sect@ltx {#1}{#2}{#3}{#4}{#5}{#6}}}%
1896 }%
1897 \def\@startsection@hook{}%
1898 % \end{macrocode}
1899 % \end{macro}
1900 %
1901 % \begin{macro}{\@sect}
1902 % When defining \cmd\@svsec, do not expand \cmd\@seccntformat.
1903 % Put brace characters back where they were before David Carlisle got at them
1904 % (i.e., as if \cmd\@hangfrom\ had two arguments).
1905 % Protect the mark mechanism from an undefined meaning.
1906 % Pass |#8| to the TOC instead of |#7|.
1907 % Remove \cmd\relax\ from the replacement part of \cmd\@svsec.
1908 %
1909 % The procedure \cmd\@hangfrom\ and \cmd\@runin@to\ can
1910 % be used to process the argument of the head.
1911 % The head can define, e.g., \cmd\@hangfrom@section, to
1912 % do its own processing.
1913 %
1914 % In using \cmd\H@refstepcounter\ in place of \cmd\refstepcounter\ we rely on
1915 % either loading before any package that patches the latter, or
1916 % the convention that the former is the original \LaTeX\ procedure.
1917 %
1918 % \begin{macrocode}
1919 \class@info
1920 {Repairing broken LateX \string\@sect}%
1921 \def\@sect@ltx#1#2#3#4#5#6[#7]#8{%
1922 \@ifnum{#2>\c@secnumdepth}{%
1923 \def\H@svsec{\phantomsection}%
1924 \let\@svsec\@empty
1925 }{%
1926 \H@refstepcounter{#1}%
1927 \def\H@svsec{%
1928 \phantomsection
1929 }%
1930 \protected@edef\@svsec{{#1}}%
1931 \@ifundefined{@#1cntformat}{%
1932 \prepdef\@svsec\@seccntformat
1933 }{%
1934 \expandafter\prepdef
1935 \expandafter\@svsec
1936 \csname @#1cntformat\endcsname
1937 }%
1938 }%
1939 \@tempskipa #5\relax
1940 \@ifdim{\@tempskipa>\z@}{%
1941 \begingroup
1942 \interlinepenalty \@M
1943 #6{%
1944 \@ifundefined{@hangfrom@#1}{\@hang@from}{\csname @hangfrom@#1\endcsname}%
1945 {\hskip#3\relax\H@svsec}{\@svsec}{#8}%
1946 }%
1947 \@@par
1948 \endgroup
1949 \@ifundefined{#1mark}{\@gobble}{\csname #1mark\endcsname}{#7}%
1950 \addcontentsline{toc}{#1}{%
1951 \@ifnum{#2>\c@secnumdepth}{%
1952 \protect\numberline{}%
1953 }{%
1954 \protect\numberline{\csname the#1\endcsname}%
1955 }%
1956 #8}%
1957 }{%
1958 \def\@svsechd{%
1959 #6{%
1960 \@ifundefined{@runin@to@#1}{\@runin@to}{\csname @runin@to@#1\endcsname}%
1961 {\hskip#3\relax\H@svsec}{\@svsec}{#8}%
1962 }%
1963 \@ifundefined{#1mark}{\@gobble}{\csname #1mark\endcsname}{#7}%
1964 \addcontentsline{toc}{#1}{%
1965 \@ifnum{#2>\c@secnumdepth}{%
1966 \protect\numberline{}%
1967 }{%
1968 \protect\numberline{\csname the#1\endcsname}%
1969 }%
1970 #8}%
1971 }%
1972 }%
1973 \@xsect{#5}%
1974 }%
1975 \def\@hang@from#1#2#3{\@hangfrom{#1#2}#3}%
1976 \def\@runin@to #1#2#3{#1#2#3}%
1977 % \end{macrocode}
1978 % \end{macro}
1979 %
1980 % \begin{macro}{\@ssect}
1981 % Put brace characters back where they were before David Carlisle got at them
1982 % (as if \cmd\@hangfrom\ has two arguments).
1983 % Possibly set a mark.
1984 % Make a TOC entry.
1985 %
1986 % Note that, for compatability with the \classname{hyperref} package, we
1987 % need to provide the interface required by that package
1988 % (actually required by \file{pdfmark.def} and \file{nameref.sty}),
1989 % namely
1990 % the definition of \cmd\@currentlabelname\ (but now removed),
1991 % the insertion of the procedure \cmd\Sectionformat\ (but why is this needed?), and
1992 % the call to \cmd\phantomsection\ (which must precede the call to \cmd\addcontentsline).
1993 % We also have to sidestep the patch to \cmd\@ssect\ in that same file, therefore
1994 % we use a different control sequence name in the call from \cmd\@startsection.
1995 % \changes{v4.0beta 3}{1999/11/13}
1996 % {Bug 116: Hyperref compatability}
1997 % \changes{v4.0rc3b}{2001/07/13}
1998 % {Bug 404: Hyperref compatability}
1999 % \begin{macrocode}
2000 \def\@ssect@ltx#1#2#3#4#5#6[#7]#8{%
2001 % \def\@currentlabelname{#8}%
2002 \def\H@svsec{\phantomsection}%
2003 \@tempskipa #5\relax
2004 \@ifdim{\@tempskipa>\z@}{%
2005 \begingroup
2006 \interlinepenalty \@M
2007 #6{%
2008 \@ifundefined{@hangfroms@#1}{\@hang@froms}{\csname @hangfroms@#1\endcsname}%
2009 % {\hskip#3\relax\H@svsec}{\Sectionformat{#8}{#1}}%
2010 {\hskip#3\relax\H@svsec}{#8}%
2011 }%
2012 \@@par
2013 \endgroup
2014 \@ifundefined{#1smark}{\@gobble}{\csname #1smark\endcsname}{#7}%
2015 \addcontentsline{toc}{#1}{\protect\numberline{}#8}%
2016 }{%
2017 \def\@svsechd{%
2018 #6{%
2019 \@ifundefined{@runin@tos@#1}{\@runin@tos}{\csname @runin@tos@#1\endcsname}%
2020 % {\hskip#3\relax\H@svsec}{\Sectionformat{#8}{#1}}%
2021 {\hskip#3\relax\H@svsec}{#8}%
2022 }%
2023 \@ifundefined{#1smark}{\@gobble}{\csname #1smark\endcsname}{#7}%
2024 \addcontentsline{toc}{#1}{\protect\numberline{}#8}%
2025 }%
2026 }%
2027 \@xsect{#5}%
2028 }%
2029 \def\@hang@froms#1#2{#1#2}%
2030 \def\@runin@tos #1#2{#1#2}%
2031 % \end{macrocode}
2032 % \end{macro}
2033 %
2034 % \begin{macro}{\init@documenthook}
2035 % Document classes that incorporate this package will be \classname{hyperref}-savvy.
2036 % (To accomplish this, we ensure that \cmd\hyperanchor\ and \cmd\hyper@last\ are both defined.)
2037 % Being \classname{hyperref}-savvy levels some requirements on us, but the benefits are many.
2038 %
2039 % One is that the TOC will not get amnesia and require a full set of three typesetting runs before its formatting is stable.
2040 % Instead, only two runs are required: the first updates the auxiliary file, the second the TOC.
2041 % However, the formatting of the document does not change.
2042 %
2043 % Another aspect of being \classname{hyperref}-savvy is that the syntax of commands in the \filename{.aux} file will now change
2044 % if \classname{hyperref} is turned on or off.
2045 %
2046 % Note that \cmd\hyper@anchorstart\ and \cmd\hyper@anchorend\ constitute the programming interface
2047 % for a hypertext anchor (the target of a hypertext link); \cmd\hyper@linkstart\ and \cmd\hyper@linkend\
2048 % are the interface for a hypertext link.
2049 % \begin{macrocode}
2050 \appdef\init@documenthook{%
2051 \providecommand\phantomsection{}%
2052 %\@ifx{\Sectionformat\@undefined}{\let\Sectionformat\@firstoftwo}{}%
2053 \providecommand\hyper@anchor[1]{}%
2054 \providecommand\hyper@last{}%
2055 \providecommand\Hy@raisedlink[1]{#1}%
2056 \providecommand\hyper@anchorstart[1]{}%
2057 \providecommand\hyper@anchorend{}%
2058 \providecommand\hyper@linkstart[2]{}%
2059 \providecommand\hyper@linkend{}%
2060 }%
2061 \let\H@refstepcounter\refstepcounter
2062 % \end{macrocode}
2063 % \end{macro}
2064 %
2065 % \begin{macro}{\sec@upcase}
2066 % Upper case for sections (optional upper case items). These are
2067 % created so that some headings can be toggled between mixed case and
2068 % upper case readily.
2069 % Headings that might be changed can be wrapped in the style file in
2070 % \cmd\sec@upcase\arg{text} constructs;
2071 % the expansion of \cmd\sec@upcase\ is
2072 % controlled here. It is \cmd\relax\ by default (mixed case heads), and
2073 % can easily be changed to \cmd\uppercase\ if desired.
2074 % If mixed-case headings are wanted by the editor, authors {\em must}
2075 % supply mixed case text, although this is what authors should be doing
2076 % anyway.
2077 % (Mixed can be converted to upper,
2078 % but the reverse transformation cannot be automated.)
2079 %
2080 % The following setting gives the \LaTeX\ default.
2081 % \begin{macrocode}
2082 \def\sec@upcase#1{\relax{#1}}%
2083 % \end{macrocode}
2084 % \end{macro}
2085 %
2086 %
2087 % \subsection{Patch the \env{tabular} and \env{array} Environments}
2088 %
2089 % \begin{macro}{\endtabular}
2090 % \begin{macro}{\endarray}
2091 % We headpatch the begin processing and tailpatch the end processing
2092 % of the \env{tabular} and \env{array} environments.
2093 % A document class can define these hooks as needed.
2094 %
2095 % We proceed with care to make further patches to
2096 % support tabulars that break over pages.
2097 % Our patches will not necessarily be effective for
2098 % other packages that replace the \LaTeX\ \env{array} and \env{tabular}
2099 % environments. I know of none that do so.
2100 % \begin{macrocode}
2101 \appdef\class@documenthook{%
2102 \@ifpackageloaded{array}{\switch@array}{\switch@tabular}%
2103 \prepdef\endtabular{\endtabular@hook}%
2104 \@provide\endtabular@hook{}%
2105 \prepdef\endarray{\endarray@hook}%
2106 \@provide\endarray@hook{}%
2107 \providecommand\array@hook{}%
2108 % \end{macrocode}
2109 % Install, effectively, a head patch to \cmd\tabular.
2110 % In order to avoid interference from, e.g., the \classname{array} package,
2111 % we must perform this patch only \emph{after} packages load.
2112 % \changes{v4.0beta 3}{1999/11/13}
2113 % {Bug 130. Interference from array package}
2114 % \begin{macrocode}
2115 \prepdef\@tabular{\tabular@hook}%
2116 \@provide\tabular@hook{}%
2117 }%
2118 % \end{macrocode}
2119 % \end{macro}
2120 % \end{macro}
2121 %
2122 % \begin{macro}{\switch@tabular}
2123 % \begin{macro}{\switch@array}
2124 % The two procedures \cmd\switch@tabular\ and \cmd\switch@array\
2125 % apply needed patches to the various tabular procedures,
2126 % the former applying to the \LaTeX\ kernel, the latter to the
2127 % required \classname{array} package (and to the number of other
2128 % required packages that load it).
2129 %
2130 % \begin{macrocode}
2131 \def\switch@tabular{%
2132 \let\@array@sw\@array@sw@array
2133 \@ifx{\@array\@array@LaTeX}{%
2134 \@ifx{\multicolumn\multicolumn@LaTeX}{%
2135 \@ifx{\@tabular\@tabular@LaTeX}{%
2136 \@ifx{\@tabarray\@tabarray@LaTeX}{%
2137 \@ifx{\array\array@LaTeX}{%
2138 \@ifx{\endarray\endarray@LaTeX}{%
2139 \@ifx{\endtabular\endtabular@LaTeX}{%
2140 \@ifx{\@mkpream\@mkpream@LaTeX}{%
2141 \@ifx{\@addamp\@addamp@LaTeX}{%
2142 \@ifx{\@arrayacol\@arrayacol@LaTeX}{%
2143 \@ifx{\@tabacol\@tabacol@LaTeX}{%
2144 \@ifx{\@arrayclassz\@arrayclassz@LaTeX}{%
2145 \@ifx{\@tabclassiv\@tabclassiv@LaTeX}{%
2146 \@ifx{\@arrayclassiv\@arrayclassiv@LaTeX}{%
2147 \@ifx{\@tabclassz\@tabclassz@LaTeX}{%
2148 \@ifx{\@classv\@classv@LaTeX}{%
2149 \@ifx{\hline\hline@LaTeX}{%
2150 \@ifx{\@tabularcr\@tabularcr@LaTeX}{%
2151 \@ifx{\@xtabularcr\@xtabularcr@LaTeX}{%
2152 \@ifx{\@xargarraycr\@xargarraycr@LaTeX}{%
2153 \@ifx{\@yargarraycr\@yargarraycr@LaTeX}{%
2154 \true@sw
2155 }{%
2156 \false@sw
2157 }%
2158 }{%
2159 \false@sw
2160 }%
2161 }{%
2162 \false@sw
2163 }%
2164 }{%
2165 \false@sw
2166 }%
2167 }{%
2168 \false@sw
2169 }%
2170 }{%
2171 \false@sw
2172 }%
2173 }{%
2174 \false@sw
2175 }%
2176 }{%
2177 \false@sw
2178 }%
2179 }{%
2180 \false@sw
2181 }%
2182 }{%
2183 \false@sw
2184 }%
2185 }{%
2186 \false@sw
2187 }%
2188 }{%
2189 \false@sw
2190 }%
2191 }{%
2192 \false@sw
2193 }%
2194 }{%
2195 \false@sw
2196 }%
2197 }{%
2198 \false@sw
2199 }%
2200 }{%
2201 \false@sw
2202 }%
2203 }{%
2204 \false@sw
2205 }%
2206 }{%
2207 \false@sw
2208 }%
2209 }{%
2210 \false@sw
2211 }%
2212 }{%
2213 \false@sw
2214 }%
2215 }{%
2216 \false@sw
2217 }%
2218 {%
2219 \class@info{Patching LaTeX tabular.}%
2220 }{%
2221 \class@info{Unrecognized LaTeX tabular. Please update this document class! (Proceeding with fingers crossed.)}%
2222 }%
2223 \let\@array\@array@ltx
2224 \let\multicolumn\multicolumn@ltx
2225 \let\@tabular\@tabular@ltx
2226 \let\@tabarray\@tabarray@ltx
2227 \let\array\array@ltx
2228 \let\endarray\endarray@ltx
2229 \let\endtabular\endtabular@ltx
2230 \let\@mkpream\@mkpream@ltx
2231 \let\@addamp\@addamp@ltx
2232 \let\@arrayacol\@arrayacol@ltx
2233 \let\@tabacol\@tabacol@ltx
2234 \let\@arrayclassz\@arrayclassz@ltx
2235 \let\@tabclassiv\@tabclassiv@ltx
2236 \let\@arrayclassiv\@arrayclassiv@ltx
2237 \let\@tabclassz\@tabclassz@ltx
2238 \let\@classv\@classv@ltx
2239 \let\hline\hline@ltx
2240 \let\@tabularcr\@tabularcr@ltx
2241 \let\@xtabularcr\@xtabularcr@ltx
2242 \let\@xargarraycr\@xargarraycr@ltx
2243 \let\@yargarraycr\@yargarraycr@ltx
2244 }%
2245 \def\switch@array{%
2246 \let\@array@sw\@array@sw@LaTeX
2247 \@ifx{\@array\@array@array}{%
2248 \@ifx{\@tabular\@tabular@array}{%
2249 \@ifx{\@tabarray\@tabarray@array}{%
2250 \@ifx{\array\array@array}{%
2251 \@ifx{\endarray\endarray@array}{%
2252 \@ifx{\endtabular\endtabular@array}{%
2253 \@ifx{\@mkpream\@mkpream@array}{%
2254 \@ifx{\@classx\@classx@array}{%
2255 \@ifx{\insert@column\insert@column@array}{%
2256 \@ifx{\@arraycr\@arraycr@array}{%
2257 \@ifx{\@xarraycr\@xarraycr@array}{%
2258 \@ifx{\@xargarraycr\@xargarraycr@array}{%
2259 \@ifx{\@yargarraycr\@yargarraycr@array}{%
2260 \true@sw
2261 }{%
2262 \false@sw
2263 }%
2264 }{%
2265 \false@sw
2266 }%
2267 }{%
2268 \false@sw
2269 }%
2270 }{%
2271 \false@sw
2272 }%
2273 }{%
2274 \false@sw
2275 }%
2276 }{%
2277 \false@sw
2278 }%
2279 }{%
2280 \false@sw
2281 }%
2282 }{%
2283 \false@sw
2284 }%
2285 }{%
2286 \false@sw
2287 }%
2288 }{%
2289 \false@sw
2290 }%
2291 }{%
2292 \false@sw
2293 }%
2294 }{%
2295 \false@sw
2296 }%
2297 }{%
2298 \false@sw
2299 }{%
2300 \class@info{Patching array package.}%
2301 }{%
2302 \class@info{Unrecognized array package. Please update this document class! (Proceeding with fingers crossed.)}%
2303 }%
2304 \let\@array \@array@array@new
2305 \let\@@array \@array % Cosi fan tutti
2306 \let\@tabular \@tabular@array@new
2307 \let\@tabarray \@tabarray@array@new
2308 \let\array \array@array@new
2309 \let\endarray \endarray@array@new
2310 \let\endtabular\endtabular@array@new
2311 \let\@mkpream \@mkpream@array@new
2312 \let\@classx \@classx@array@new
2313 \let\@arrayacol\@arrayacol@ltx
2314 \let\@tabacol \@tabacol@ltx
2315 \let\insert@column\insert@column@array@new
2316 \expandafter\let\csname endtabular*\endcsname\endtabular % Cosi fan tutti
2317 \let\@arraycr \@arraycr@new
2318 \let\@xarraycr \@xarraycr@new
2319 \let\@xargarraycr\@xargarraycr@new
2320 \let\@yargarraycr\@yargarraycr@new
2321 }%
2322 % \end{macrocode}
2323 % \end{macro}
2324 % \end{macro}
2325 %
2326 % \begin{macro}{\@array@sw}
2327 % The Boolean \cmd\@array@sw\ must be different depending on
2328 % whether the \classname{array} package is loaded.
2329 % \begin{macrocode}
2330 \def\@array@sw@LaTeX{\@ifx{\\\@tabularcr}}%
2331 \def\@array@sw@array{\@ifx{\d@llarbegin\begingroup}}%
2332 % \end{macrocode}
2333 % \end{macro}
2334 %
2335 % \begin{macro}{\@tabular}
2336 % We provide the old versions of \cmd\@tabular\ along with the respective new versions.
2337 % The change here is to avoid committing to LR mode. That will be done later (as late as possible, naturally).
2338 % \begin{macrocode}
2339 \def\@tabular@LaTeX{%
2340 \leavevmode
2341 \hbox\bgroup$%
2342 \let\@acol\@tabacol
2343 \let\@classz\@tabclassz
2344 \let\@classiv\@tabclassiv
2345 \let\\\@tabularcr
2346 \@tabarray
2347 }%
2348 \def\@tabular@ltx{%
2349 \let\@acoll\@tabacoll
2350 \let\@acolr\@tabacolr
2351 \let\@acol\@tabacol
2352 \let\@classz\@tabclassz
2353 \let\@classiv\@tabclassiv
2354 \let\\\@tabularcr
2355 \@tabarray
2356 }%
2357 \def\@tabular@array{%
2358 \leavevmode
2359 \hbox\bgroup$%
2360 \col@sep\tabcolsep
2361 \let\d@llarbegin\begingroup
2362 \let\d@llarend\endgroup
2363 \@tabarray
2364 }%
2365 \def\@tabular@array@new{%
2366 \let\@acoll\@tabacoll
2367 \let\@acolr\@tabacolr
2368 \let\@acol\@tabacol
2369 \let\col@sep\@undefined
2370 \let\d@llarbegin\begingroup
2371 \let\d@llarend\endgroup
2372 \@tabarray
2373 }%
2374 % \end{macrocode}
2375 % \end{macro}
2376 %
2377 % \begin{macro}{\@tabarray}
2378 % Here we provide old and new versions of the \cmd\@tabarray\ procedure.
2379 % The change here is to parametrize the default vertical alignment,
2380 % which is 'c' in standard \LaTeX.
2381 % Under some circumstances, we want to change this to, say, 'v'.
2382 %
2383 % FIXME: must decouple \env{array} and \env{tabular}.
2384 % \begin{macrocode}
2385 \def\@tabarray@LaTeX{%
2386 \m@th\@ifnextchar[\@array{\@array[c]}%
2387 }%
2388 \def\@tabarray@ltx{%
2389 \m@th\@ifnextchar[\@array{\expandafter\@array\expandafter[\array@default]}%
2390 }%
2391 \def\@tabarray@array{%
2392 \@ifnextchar[{\@@array}{\@@array[c]}%
2393 }%
2394 \def\@tabarray@array@new{%
2395 \@ifnextchar[{\@@array}{\expandafter\@@array\expandafter[\array@default]}%
2396 }%
2397 % \end{macrocode}
2398 % \end{macro}
2399 %
2400 % \begin{macro}{\@tabularcr}
2401 % \begin{macro}{\@tbpen}
2402 % \begin{macro}{\@tabularcr}
2403 % \begin{macro}{\@xtabularcr}
2404 % \begin{macro}{\@xargarraycr}
2405 % \begin{macro}{\@yargarraycr}
2406 % \begin{macro}{\@arraycr}
2407 % \begin{macro}{\@xarraycr}
2408 % We provide for the \cmd\\ command within \env{tabular} to provide control over page breaking, just the same as
2409 % that of \env{eqnarray}.
2410 %
2411 % The count register \cmd\intertabularlinepenalty\ is similar to \cmd\interdisplaylinepenalty: it is the penalty
2412 % associated with each row of a tabular. When it is set to \cmd\@M, the tabular will cleave together.
2413 %
2414 % The count register \cmd\@tbpen\ is similar to \cmd\@eqpen: it memorizes the penalty to use after the current tabular row.
2415 % If the \cmd\\ command is in its star form, then \cmd\@eqpen\ is set to \cmd\@M.
2416 %
2417 % We append code to \cmd\samepage\ so that a tabular within its scope will cleave together.
2418 %
2419 % We keep the standard definition of \cmd\@tabularcr\ in \cmd\@tabularcr@LaTeX\ for reference,
2420 % and provide a new definition that works like \cmd\@eqncr: it sets \cmd\@tbpen\ to \cmd\@M\ if the star was given.
2421 %
2422 % We also provide new versions of \cmd\@xtabularcr, \cmd\@xargarraycr, and \cmd\@yargarraycr, all of which invoke \cmd\@tbpen.
2423 %
2424 % The \cmd\switch@tabular\ procedure switches in the new definitions.
2425 % \begin{macrocode}
2426 \newcount\intertabularlinepenalty
2427 \intertabularlinepenalty=100
2428 \newcount\@tbpen
2429 \appdef\samepage{\intertabularlinepenalty\@M}%
2430 \def\@tabularcr@LaTeX{{\ifnum 0=`}\fi \@ifstar \@xtabularcr \@xtabularcr}%
2431 \def\@tabularcr@ltx{{\ifnum 0=`}\fi \@ifstar {\global \@tbpen \@M \@xtabularcr }{\global \@tbpen \intertabularlinepenalty \@xtabularcr }}%
2432 \def\@xtabularcr@LaTeX{\@ifnextchar [\@argtabularcr {\ifnum 0=`{\fi }\cr }}%
2433 \def\@xtabularcr@ltx{\@ifnextchar [\@argtabularcr {\ifnum 0=`{\fi }\cr \noalign {\penalty \@tbpen }}}%
2434 \def\@xargarraycr@LaTeX#1{\@tempdima #1\advance \@tempdima \dp \@arstrutbox \vrule \@height \z@ \@depth \@tempdima \@width \z@ \cr}%
2435 \def\@xargarraycr@ltx#1{\@tempdima #1\advance \@tempdima \dp \@arstrutbox \vrule \@height \z@ \@depth \@tempdima \@width \z@ \cr \noalign {\penalty \@tbpen }}%
2436 \def\@yargarraycr@LaTeX#1{\cr \noalign {\vskip #1}}%
2437 \def\@yargarraycr@ltx#1{\cr \noalign {\penalty \@tbpen \vskip #1}}%
2438 % \end{macrocode}
2439 %
2440 % If the \classname{array} package has been loaded, we must alter the meanings of
2441 % \cmd\@arraycr, \cmd\@xarraycr, \cmd\@xargarraycr, and \cmd\@yargarraycr.
2442 % In this case, it is \cmd\switch@array\ that switches in the new definitions.
2443 % \begin{macrocode}
2444 \def\@arraycr@array{%
2445 \relax
2446 \iffalse{\fi\ifnum 0=`}\fi
2447 \@ifstar \@xarraycr \@xarraycr
2448 }%
2449 \def\@arraycr@new{%
2450 \relax
2451 \iffalse{\fi\ifnum 0=`}\fi
2452 \@ifstar {\global \@tbpen \@M \@xarraycr }{\global \@tbpen \intertabularlinepenalty \@xarraycr }%
2453 }%
2454 \def\@xarraycr@array{%
2455 \@ifnextchar [%]
2456 \@argarraycr {\ifnum 0=`{}\fi\cr}%
2457 }%
2458 \def\@xarraycr@new{%
2459 \@ifnextchar [%]
2460 \@argarraycr {\ifnum 0=`{}\fi\cr \noalign {\penalty \@tbpen }}%
2461 }%
2462 \def\@xargarraycr@array#1{%
2463 \unskip
2464 \@tempdima #1\advance\@tempdima \dp\@arstrutbox
2465 \vrule \@depth\@tempdima \@width\z@
2466 \cr
2467 }%
2468 \def\@xargarraycr@new#1{%
2469 \unskip
2470 \@tempdima #1\advance\@tempdima \dp\@arstrutbox
2471 \vrule \@depth\@tempdima \@width\z@
2472 \cr
2473 \noalign {\penalty \@tbpen }%
2474 }%
2475 \def\@yargarraycr@array#1{%
2476 \cr
2477 \noalign{\vskip #1}%
2478 }%
2479 \def\@yargarraycr@new#1{%
2480 \cr
2481 \noalign{\penalty \@tbpen \vskip #1}%
2482 }%
2483 % \end{macrocode}
2484 % \end{macro}
2485 % \end{macro}
2486 % \end{macro}
2487 % \end{macro}
2488 % \end{macro}
2489 % \end{macro}
2490 % \end{macro}
2491 % \end{macro}
2492 %
2493 % \begin{macro}{\array}
2494 % We provide old and new versions of the \cmd\array\ procedure for both \LaTeX\ and the \classname{array} package.
2495 % The change here is to accomodate the new procedures that will be called for the array boundaries, even
2496 % though at present they are not special.
2497 % A thought: here is where matrices can be readily accomodated.
2498 % \begin{macrocode}
2499 \def\array@LaTeX{%
2500 \let\@acol\@arrayacol
2501 \let\@classz\@arrayclassz
2502 \let\@classiv\@arrayclassiv
2503 \let\\\@arraycr
2504 \let\@halignto\@empty
2505 \@tabarray
2506 }%
2507 \def\array@ltx{%
2508 \@ifmmode{}{\@badmath$}%
2509 \let\@acoll\@arrayacol
2510 \let\@acolr\@arrayacol
2511 \let\@acol\@arrayacol
2512 \let\@classz\@arrayclassz
2513 \let\@classiv\@arrayclassiv
2514 \let\\\@arraycr
2515 \let\@halignto\@empty
2516 \@tabarray
2517 }%
2518 \def\array@array{%
2519 \col@sep\arraycolsep
2520 \def\d@llarbegin{$}\let\d@llarend\d@llarbegin\gdef\@halignto{}%
2521 \@tabarray
2522 }
2523 \def\array@array@new{%
2524 \@ifmmode{}{\@badmath$}%
2525 \let\@acoll\@arrayacol
2526 \let\@acolr\@arrayacol
2527 \let\@acol\@arrayacol
2528 \let\col@sep\@undefined
2529 \def\d@llarbegin{$}%
2530 \let\d@llarend\d@llarbegin
2531 \gdef\@halignto{}%
2532 \@tabarray
2533 }%
2534 % \end{macrocode}
2535 % \end{macro}
2536 %
2537 % \begin{macro}{\@array}
2538 % Here we provide old and new versions of \cmd\@array.
2539 % The change here is to provide a convenient, flexible, and extensible
2540 % mechanism for new vertical alignment options.
2541 %
2542 % Instead of testing the optional argument with \cmd\if, we
2543 % use a dispatcher based on \cmd\csname.
2544 %
2545 % We also refrain from using \cmd\ialign, which would set
2546 % the \cmd\tabskip\ to the wrong value.
2547 %
2548 % Finally, the procedure to set the \cmd\@arstrutbox\
2549 % is broken out so that it can be patched.
2550 % \begin{macrocode}
2551 \def\@array@LaTeX[#1]#2{%
2552 \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
2553 \bgroup
2554 \setbox\@arstrutbox\hbox{%
2555 \vrule \@height\arraystretch\ht\strutbox
2556 \@depth\arraystretch \dp\strutbox
2557 \@width\z@}%
2558 \@mkpream{#2}%
2559 \edef\@preamble{%
2560 \ialign \noexpand\@halignto
2561 \bgroup \@arstrut \@preamble \tabskip\z@skip \cr}%
2562 \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
2563 \let\tabularnewline\\%
2564 \let\par\@empty
2565 \let\@sharp##%
2566 \set@typeset@protect
2567 \lineskip\z@skip\baselineskip\z@skip
2568 \ifhmode \@preamerr\z@ \@@par\fi
2569 \@preamble
2570 }%
2571 \def\@array@ltx[#1]#2{%
2572 \@nameuse{@array@align@#1}%
2573 \set@arstrutbox
2574 \@mkpream{#2}%
2575 \prepdef\@preamble{%
2576 \tabskip\tabmid@skip
2577 \@arstrut
2578 }%
2579 \appdef\@preamble{%
2580 \tabskip\tabright@skip
2581 \cr
2582 \array@row@pre
2583 }%
2584 % \let\@startpbox\@@startpbox
2585 % \let\@endpbox\@@endpbox
2586 \let\tabularnewline\\%
2587 \let\par\@empty
2588 \let\@sharp##%
2589 \set@typeset@protect
2590 \lineskip\z@skip\baselineskip\z@skip
2591 \tabskip\tableft@skip\relax
2592 \ifhmode \@preamerr\z@ \@@par\fi
2593 \everycr{}%
2594 \expandafter\halign\expandafter\@halignto\expandafter\bgroup\@preamble
2595 }%
2596 %
2597 \def\set@arstrutbox{%
2598 \setbox\@arstrutbox\hbox{%
2599 \vrule \@height\arraystretch\ht\strutbox
2600 \@depth\arraystretch \dp\strutbox
2601 \@width\z@
2602 }%
2603 }%
2604 % \end{macrocode}
2605 % \end{macro}
2606 %
2607 % \begin{macro}{\@array@array}
2608 %
2609 % \begin{macrocode}
2610 \def\@array@array[#1]#2{%
2611 \@tempdima \ht \strutbox
2612 \advance \@tempdima by\extrarowheight
2613 \setbox \@arstrutbox \hbox{\vrule
2614 \@height \arraystretch \@tempdima
2615 \@depth \arraystretch \dp \strutbox
2616 \@width \z@}%
2617 \begingroup
2618 \@mkpream{#2}%
2619 \xdef\@preamble{\noexpand \ialign \@halignto
2620 \bgroup \@arstrut \@preamble
2621 \tabskip \z@ \cr}%
2622 \endgroup
2623 \@arrayleft
2624 \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
2625 \bgroup
2626 \let \@sharp ##\let \protect \relax
2627 \lineskip \z@
2628 \baselineskip \z@
2629 \m@th
2630 \let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble
2631 }%
2632 \def\@array@array@new[#1]#2{%
2633 \@tempdima\ht\strutbox
2634 \advance\@tempdima by\extrarowheight
2635 \setbox\@arstrutbox\hbox{%
2636 \vrule \@height\arraystretch\@tempdima
2637 \@depth \arraystretch\dp\strutbox
2638 \@width \z@
2639 }%
2640 \begingroup
2641 \@mkpream{#2}%
2642 \xdef\@preamble{\@preamble}%
2643 \endgroup
2644 \prepdef\@preamble{%
2645 \tabskip\tabmid@skip
2646 \@arstrut
2647 }%
2648 \appdef\@preamble{%
2649 \tabskip\tabright@skip
2650 \cr
2651 \array@row@pre
2652 }%
2653 \@arrayleft
2654 \@nameuse{@array@align@#1}%
2655 \m@th
2656 \let\\\@arraycr
2657 \let\tabularnewline\\%
2658 \let\par\@empty
2659 \let\@sharp##%
2660 \set@typeset@protect
2661 \lineskip\z@\baselineskip\z@
2662 \tabskip\tableft@skip
2663 \everycr{}%
2664 \expandafter\halign\expandafter\@halignto\expandafter\bgroup\@preamble
2665 }%
2666 % \end{macrocode}
2667 % \end{macro}
2668 %
2669 % \begin{macro}{\endarray}
2670 % Here we provide old and new versions of \cmd\endarray.
2671 % The change here is to use a single procedure to close
2672 % out any array-like structure, namely \cmd\endarray@ltx.
2673 % It merely closes out the \cmd\halign.
2674 % \begin{macrocode}
2675 \def\endarray@LaTeX{%
2676 \crcr\egroup\egroup
2677 }%
2678 \def\endarray@ltx{%
2679 \crcr\array@row@pst\egroup\egroup
2680 }%
2681 \def\endarray@array{%
2682 \crcr \egroup \egroup \@arrayright \gdef\@preamble{}%
2683 }%
2684 \def\endarray@array@new{%
2685 \crcr\array@row@pst\egroup\egroup % Same as \endarray@ltx
2686 \@arrayright
2687 \global\let\@preamble\@empty
2688 }%
2689 % \end{macrocode}
2690 % \end{macro}
2691 %
2692 % \begin{macro}{\endtabular}
2693 %
2694 % \begin{macrocode}
2695 \def\endtabular@LaTeX{%
2696 \crcr\egroup\egroup $\egroup
2697 }%
2698 \def\endtabular@ltx{%
2699 \endarray
2700 }%
2701 \def\endtabular@array{%
2702 \endarray $\egroup
2703 }%
2704 \def\endtabular@array@new{%
2705 \endarray
2706 }%
2707 % \end{macrocode}
2708 % \end{macro}
2709 %
2710 % \begin{macro}{endtabular*}
2711 % Here we provide a proper definition for the star-form of \enve{endtabular}.
2712 % It is one of the enduring curiosities that the \LaTeX\ kernel continues to use
2713 % dangerously and inappropriately ``optimized'' definitions for such commands.
2714 % \begin{macrocode}
2715 \@namedef{endtabular*}{\endtabular}%
2716 % \end{macrocode}
2717 % \end{macro}
2718 %
2719 % \begin{macro}{\multicolumn}
2720 %
2721 % \begin{macrocode}
2722 \long\def\multicolumn@LaTeX#1#2#3{%
2723 \multispan{#1}\begingroup
2724 \@mkpream{#2}%
2725 \def\@sharp{#3}\set@typeset@protect
2726 \let\@startpbox\@@startpbox\let\@endpbox\@@endpbox
2727 \@arstrut \@preamble\hbox{}\endgroup\ignorespaces
2728 }%
2729 \long\def\multicolumn@ltx#1#2#3{%
2730 \multispan{#1}%
2731 \begingroup
2732 \@mkpream{#2}%
2733 \def\@sharp{#3}%
2734 \set@typeset@protect
2735 %\let\@startpbox\@@startpbox\let\@endpbox\@@endpbox
2736 \@arstrut
2737 \@preamble
2738 \hbox{}%
2739 \endgroup
2740 \ignorespaces
2741 }%
2742 % \end{macrocode}
2743 % \end{macro}
2744 %
2745 % \begin{macro}{\@array@align@}
2746 % \begin{macro}{\array@default}
2747 % Here are the various procedures for the vertical alignment options.
2748 % The change from standard \LaTeX\ is that we do not go into math mode
2749 % in every case: only when required by \cmd\vcenter.
2750 % Also, we use \cmd\aftergroup\ to close out the boxes and modes we have started.
2751 % It requires only that each procedure issue exactly one unmatched \cmd\bgroup.
2752 %
2753 % We establish here the default vertical alignment.
2754 % \begin{macrocode}
2755 \def\@array@align@t{\leavevmode\vtop\bgroup}%
2756 \def\@array@align@b{\leavevmode\vbox\bgroup}%
2757 \def\@array@align@c{\leavevmode\@ifmmode{\vcenter\bgroup}{$\vcenter\bgroup\aftergroup$\aftergroup\relax}}%
2758 \def\@array@align@v{%
2759 \@ifmmode{%
2760 \@badmath
2761 \vcenter\bgroup
2762 }{%
2763 \@ifinner{%
2764 $\vcenter\bgroup\aftergroup$
2765 }{%
2766 \@@par\bgroup
2767 }%
2768 }%
2769 }%
2770 \def\array@default{c}%
2771 % \end{macrocode}
2772 % \end{macro}
2773 % \end{macro}
2774 %
2775 % \begin{macro}{\array@row@pre}
2776 % \begin{macro}{\array@row@pst}
2777 % \begin{macro}{\array@row@rst}
2778 % The procedure \cmd\array@row@rst\ reestablishes a default context for
2779 % an alignment, so that they can be nested.
2780 % Any environment or procedure that alters the way alignments are formatted
2781 % must patch this procedure to restore from that alteration.
2782 % To start things off, we equate \cmd\@array@align@v\ to \cmd\@array@align@c,
2783 % because it does not make sense to do the former in any context other
2784 % than the MVL or in a list that will be unboxed onto the MVL.
2785 % \begin{macrocode}
2786 \def\array@row@rst{%
2787 \let\@array@align@v\@array@align@c
2788 }%
2789 \def\array@row@pre{}%
2790 \def\array@row@pst{}%
2791 % \end{macrocode}
2792 % \end{macro}
2793 % \end{macro}
2794 % \end{macro}
2795 %
2796 % \begin{macro}{\toprule}
2797 % \begin{macro}{\colrule}
2798 % \begin{macro}{\botrule}
2799 % Default definitions for \cmd\toprule, \cmd\colrule, \cmd\botrule
2800 % \begin{macrocode}
2801 \newcommand\toprule{\tab@rule{\column@font}{\column@fil}{\frstrut}}%
2802 \newcommand\colrule{\unskip\lrstrut\\\tab@rule{\body@font}{}{\frstrut}}%
2803 \newcommand\botrule{\unskip\lrstrut\\\noalign{\hline@rule}{}}%
2804 % \end{macrocode}
2805 % \end{macro}
2806 % \end{macro}
2807 % \end{macro}
2808 %
2809 % \begin{macro}{\hline}
2810 % \begin{macrocode}
2811 \def\hline@LaTeX{%
2812 \noalign{\ifnum0=`}\fi\hrule \@height \arrayrulewidth \futurelet
2813 \reserved@a\@xhline
2814 }%
2815 \def\hline@ltx{%
2816 \noalign{%
2817 \ifnum0=`}\fi
2818 \hline@rule
2819 \futurelet\reserved@a\@xhline
2820 % \noalign ended in \@xhline
2821 }%
2822 \def\@xhline@unneeded{%
2823 \say\reserved@a
2824 \ifx\reserved@a\hline
2825 \vskip\doublerulesep
2826 \vskip-\arrayrulewidth
2827 \fi
2828 \ifnum0=`{\fi}%
2829 }%
2830 \def\tab@rule#1#2#3{%
2831 \crcr
2832 \noalign{%
2833 \hline@rule
2834 \gdef\@arstrut@hook{%
2835 \global\let\@arstrut@hook\@empty
2836 #3%
2837 }%
2838 \gdef\cell@font{#1}%
2839 \gdef\cell@fil{#2}%
2840 }%
2841 }%
2842 \def\column@font{}%
2843 \def\column@fil{}%
2844 \def\body@font{}%
2845 \def\cell@font{}%
2846 \def\frstrut{}%
2847 \def\lrstrut{}%
2848 % \end{macrocode}
2849 % \end{macro}
2850 %
2851 % \begin{macro}{\@arstrut@hline}
2852 % \begin{macro}{\@arstrut@org}
2853 % \begin{macro}{\@arstrut@hook}
2854 % \begin{macro}{\@arstrutbox@hline}
2855 % \begin{macro}{\set@arstrutbox}
2856 % \begin{macro}{\hline@rule}
2857 % The procedure \cmd\@arstrut@hline\ is substantially the same as
2858 % \cmd\@arstrut, except the strut copied in is \cmd\@arstrutbox@hline
2859 % instead of \cmd\@arstrutbox.
2860 %
2861 % The procedure \cmd\@arstrut@hook\ is redefined in \cmd\tab@rule!
2862 %
2863 % The register \cmd\@arstrutbox@hline.
2864 %
2865 % We append to \cmd\set@arstrutbox\ the code necessary to set a strut following an \cmd\hline.
2866 %
2867 % The procedure \cmd\hline@rule\ lays down a rule, and changes the meaning of \cmd\@arstrut\
2868 % so that the next line will be correctly strutted.
2869 %
2870 % The \cmd\@arstrut@hline@clnc\ is a klootch, a magic number.
2871 % \begin{macrocode}
2872 \def\@arstrut@hline{%
2873 \relax
2874 \@ifmmode{\copy}{\unhcopy}\@arstrutbox@hline
2875 \@arstrut@hook
2876 }%
2877 %
2878 \let\@arstrut@org\@arstrut
2879 \def\@arstrut@hook{%
2880 \global\let\@arstrut\@arstrut@org
2881 }%
2882 %
2883 \newbox\@arstrutbox@hline
2884 \appdef\set@arstrutbox{%
2885 \setbox\@arstrutbox@hline\hbox{%
2886 \setbox\z@\hbox{$0^{0}_{}$}%
2887 \dimen@\ht\z@\advance\dimen@\@arstrut@hline@clnc
2888 \@ifdim{\dimen@<\arraystretch\ht\strutbox}{\dimen@=\arraystretch\ht\strutbox}{}%
2889 \vrule \@height\dimen@
2890 \@depth\arraystretch \dp\strutbox
2891 \@width\z@
2892 }%
2893 }%
2894 %
2895 \def\hline@rule{%
2896 \hrule \@height \arrayrulewidth
2897 \global\let\@arstrut\@arstrut@hline
2898 }%
2899 \def\@arstrut@hline@clnc{2\p@}% % Klootch: magic number
2900 % \end{macrocode}
2901 % \end{macro}
2902 % \end{macro}
2903 % \end{macro}
2904 % \end{macro}
2905 % \end{macro}
2906 % \end{macro}
2907 %
2908 % \begin{macro}{\tableft@skip}
2909 % \begin{macrocode}
2910 \def\tableft@skip{\z@skip}%
2911 \def\tabmid@skip{\z@skip}%\@flushglue
2912 \def\tabright@skip{\z@skip}%
2913 \def\tableftsep{\tabcolsep}%
2914 \def\tabmidsep{\tabcolsep}%
2915 \def\tabrightsep{\tabcolsep}%
2916 \def\cell@fil{}%
2917 \def\pbox@hook{}%
2918 % \end{macrocode}
2919 % \end{macro}
2920 %
2921 % \begin{macro}{\@arstrut}
2922 % \begin{macrocode}
2923 \appdef\@arstrut{\@arstrut@hook}%
2924 \let\@arstrut@hook\@empty
2925 \def\@addtopreamble{\appdef\@preamble}%
2926 % \end{macrocode}
2927 % \end{macro}
2928 %
2929 % \begin{macro}{\@mkpream}
2930 % \begin{macrocode}
2931 \def\@mkpream@LaTeX#1{%
2932 \@firstamptrue\@lastchclass6
2933 \let\@preamble\@empty
2934 \let\protect\@unexpandable@protect
2935 \let\@sharp\relax
2936 \let\@startpbox\relax\let\@endpbox\relax
2937 \@expast{#1}%
2938 \expandafter\@tfor \expandafter
2939 \@nextchar \expandafter:\expandafter=\reserved@a\do
2940 {\@testpach\@nextchar
2941 \ifcase \@chclass \@classz \or \@classi \or \@classii \or \@classiii
2942 \or \@classiv \or\@classv \fi\@lastchclass\@chclass}%
2943 \ifcase \@lastchclass \@acol
2944 \or \or \@preamerr \@ne\or \@preamerr \tw@\or \or \@acol \fi
2945 }%
2946 \def\@mkpream@ltx#1{%
2947 \@firstamptrue
2948 \@lastchclass6
2949 \let\@preamble\@empty
2950 \let\protect\@unexpandable@protect
2951 \let\@sharp\relax
2952 %\let\@startpbox\relax\let\@endpbox\relax
2953 \@expast{#1}%
2954 \expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=\reserved@a
2955 \do{%
2956 \expandafter\@testpach\expandafter{\@nextchar}%
2957 \ifcase\@chclass
2958 \@classz
2959 \or
2960 \@classi
2961 \or
2962 \@classii
2963 \or
2964 \@classiii
2965 \or
2966 \@classiv
2967 \or
2968 \@classv
2969 \fi
2970 \@lastchclass\@chclass
2971 }%
2972 \ifcase\@lastchclass
2973 \@acolr % right-hand column
2974 \or
2975 \or
2976 \@preamerr\@ne
2977 \or
2978 \@preamerr\tw@
2979 \or
2980 \or
2981 \@acolr % right-hand column
2982 \fi
2983 }%
2984 % \end{macrocode}
2985 % \end{macro}
2986 %
2987 % \begin{macro}{\insert@column}
2988 % \begin{macrocode}
2989 \def\insert@column@array{%
2990 \the@toks \the \@tempcnta
2991 \ignorespaces \@sharp \unskip
2992 \the@toks \the \count@ \relax
2993 }%
2994 \def\insert@column@array@new{%
2995 \the@toks\the\@tempcnta
2996 \array@row@rst\cell@font
2997 \ignorespaces\@sharp\unskip
2998 \the@toks\the\count@
2999 \relax
3000 }%
3001 % \end{macrocode}
3002 % \end{macro}
3003 %
3004 % \begin{macro}{\@mkpream@relax}
3005 % The procedure \cmd\@mkpream@relax\ participates in a strange and wonderful
3006 % method of binding the alignment procedure---but only certain parts thereof.
3007 %
3008 % Here is how it works: in \LaTeX, the \classname{array} package, and in the
3009 % \classname{longtable} package alike, there is a need to create an alignment
3010 % preamble (using \cmd\@mkpream) for use by the upcoming \cmd\halign.
3011 % Then, in both \classname{array} and \classname{longtable}, \TeX's \cmd\edef\
3012 % is used to `compile in place' that alignment preamble.
3013 %
3014 % In the case of \classname{array}, the operation is done in order to
3015 % pre-expand the use of \texttt{*}, in \classname{longtable}, it is to
3016 % set the widths of the columns.
3017 %
3018 % Now, during this \cmd\edef, certain control sequence names must \emph{not}
3019 % be expanded, and those are robustified by \cmd\@mkpream@relax.
3020 %
3021 % \begin{macrocode}
3022 \def\@mkpream@relax{%
3023 \let\tableftsep\relax
3024 \let\tabmidsep\relax
3025 \let\tabrightsep\relax
3026 \let\array@row@rst\relax
3027 \let\cell@font\relax
3028 \let\@startpbox\relax
3029 }%
3030 % \end{macrocode}
3031 % \end{macro}
3032 %
3033 % \begin{macro}{\@mkpream}
3034 % \begin{macrocode}
3035 \def\@mkpream@array#1{%
3036 \gdef\@preamble{}\@lastchclass 4 \@firstamptrue
3037 \let\@sharp\relax \let\@startpbox\relax \let\@endpbox\relax
3038 \@temptokena{#1}\@tempswatrue
3039 \@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}%
3040 \count@\m@ne
3041 \let\the@toks\relax
3042 \prepnext@tok
3043 \expandafter \@tfor \expandafter \@nextchar
3044 \expandafter :\expandafter =\the\@temptokena \do
3045 {\@testpach
3046 \ifcase \@chclass \@classz \or \@classi \or \@classii
3047 \or \save@decl \or \or \@classv \or \@classvi
3048 \or \@classvii \or \@classviii
3049 \or \@classx
3050 \or \@classx \fi
3051 \@lastchclass\@chclass}%
3052 \ifcase\@lastchclass
3053 \@acol \or
3054 \or
3055 \@acol \or
3056 \@preamerr \thr@@ \or
3057 \@preamerr \tw@ \@addtopreamble\@sharp \or
3058 \or
3059 \else \@preamerr \@ne \fi
3060 \def\the@toks{\the\toks}%
3061 }%
3062 \def\@mkpream@array@new#1{%
3063 \gdef\@preamble{}%
3064 \@lastchclass\f@ur
3065 \@firstamptrue
3066 \let\@sharp\relax
3067 \@mkpream@relax
3068 %\let\@startpbox\relax\let\@endpbox\relax
3069 \@temptokena{#1}\@tempswatrue
3070 \@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}%
3071 \count@\m@ne
3072 \let\the@toks\relax
3073 \prepnext@tok
3074 \expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=\the\@temptokena
3075 \do{%
3076 \@testpach
3077 \ifcase\@chclass
3078 \@classz
3079 \or
3080 \@classi
3081 \or
3082 \@classii
3083 \or
3084 \save@decl
3085 \or
3086 \or
3087 \@classv
3088 \or
3089 \@classvi
3090 \or
3091 \@classvii
3092 \or
3093 \@classviii
3094 \or
3095 \@classx
3096 \or
3097 \@classx
3098 \fi
3099 \@lastchclass\@chclass
3100 }%
3101 \ifcase\@lastchclass
3102 \@acolr % right-hand column
3103 \or
3104 \or
3105 \@acolr % right-hand column
3106 \or
3107 \@preamerr\thr@@
3108 \or
3109 \@preamerr\tw@\@addtopreamble\@sharp
3110 \or
3111 \or
3112 \else
3113 \@preamerr\@ne
3114 \fi
3115 \def\the@toks{\the\toks}%
3116 }%
3117 % \end{macrocode}
3118 % \end{macro}
3119 %
3120 % \begin{macro}{\@addamp}
3121 % \begin{macrocode}
3122 \def\@addamp@LaTeX{%
3123 \if@firstamp\@firstampfalse\else\edef\@preamble{\@preamble &}\fi
3124 }%
3125 \def\@addamp@ltx{%
3126 \if@firstamp\@firstampfalse\else\@addtopreamble{&}\fi
3127 }%
3128 % \end{macrocode}
3129 % \end{macro}
3130 %
3131 % \begin{macro}{\@arrayacol}
3132 % \begin{macrocode}
3133 \def\@arrayacol@LaTeX{%
3134 \edef\@preamble{\@preamble \hskip \arraycolsep}%
3135 }%
3136 \def\@arrayacol@ltx{%
3137 \@addtopreamble{\hskip\arraycolsep}%
3138 }%
3139 % \end{macrocode}
3140 % \end{macro}
3141 %
3142 % \begin{macro}{\@tabacol}
3143 % \begin{macrocode}
3144 \def\@tabacoll{%
3145 \@addtopreamble{\hskip\tableftsep\relax}%
3146 }%
3147 \def\@tabacol@LaTeX{%
3148 \edef\@preamble{\@preamble \hskip \tabcolsep}%
3149 }%
3150 \def\@tabacol@ltx{%
3151 \@addtopreamble{\hskip\tabmidsep\relax}%
3152 }%
3153 \def\@tabacolr{%
3154 \@addtopreamble{\hskip\tabrightsep\relax}%
3155 }%
3156 % \end{macrocode}
3157 % \end{macro}
3158 %
3159 % \begin{macro}{\@arrayclassz}
3160 % \begin{macrocode}
3161 \def\@arrayclassz@LaTeX{%
3162 \ifcase \@lastchclass \@acolampacol \or \@ampacol \or
3163 \or \or \@addamp \or
3164 \@acolampacol \or \@firstampfalse \@acol \fi
3165 \edef\@preamble{\@preamble
3166 \ifcase \@chnum
3167 \hfil$\relax\@sharp$\hfil \or $\relax\@sharp$\hfil
3168 \or \hfil$\relax\@sharp$\fi}%
3169 }%
3170 \def\@arrayclassz@ltx{%
3171 \ifcase\@lastchclass
3172 \@acolampacol
3173 \or
3174 \@ampacol
3175 \or
3176 \or
3177 \or
3178 \@addamp
3179 \or
3180 \@acolampacol
3181 \or
3182 \@firstampfalse\@acoll
3183 \fi
3184 \ifcase\@chnum
3185 \@addtopreamble{%
3186 \hfil\array@row@rst$\relax\@sharp$\hfil
3187 }%
3188 \or
3189 \@addtopreamble{%
3190 \array@row@rst$\relax\@sharp$\hfil
3191 }%
3192 \or
3193 \@addtopreamble{%
3194 \hfil\array@row@rst$\relax\@sharp$%
3195 }%
3196 \fi
3197 }%
3198 % \end{macrocode}
3199 % \end{macro}
3200 %
3201 % \begin{macro}{\@tabclassz}
3202 % \begin{macrocode}
3203 \def\@tabclassz@LaTeX{%
3204 \ifcase\@lastchclass
3205 \@acolampacol
3206 \or
3207 \@ampacol
3208 \or
3209 \or
3210 \or
3211 \@addamp
3212 \or
3213 \@acolampacol
3214 \or
3215 \@firstampfalse\@acol
3216 \fi
3217 \edef\@preamble{%
3218 \@preamble{%
3219 \ifcase\@chnum
3220 \hfil\ignorespaces\@sharp\unskip\hfil
3221 \or
3222 \hskip1sp\ignorespaces\@sharp\unskip\hfil
3223 \or
3224 \hfil\hskip1sp\ignorespaces\@sharp\unskip
3225 \fi}}%
3226 }%
3227 \def\@tabclassz@ltx{%
3228 \ifcase\@lastchclass
3229 \@acolampacol
3230 \or
3231 \@ampacol
3232 \or
3233 \or
3234 \or
3235 \@addamp
3236 \or
3237 \@acolampacol
3238 \or
3239 \@firstampfalse\@acoll
3240 \fi
3241 \ifcase\@chnum
3242 \@addtopreamble{%
3243 {\hfil\array@row@rst\cell@font\ignorespaces\@sharp\unskip\hfil}%
3244 }%
3245 \or
3246 \@addtopreamble{%
3247 {\cell@fil\hskip1sp\array@row@rst\cell@font\ignorespaces\@sharp\unskip\hfil}%
3248 }%
3249 \or
3250 \@addtopreamble{%
3251 {\hfil\hskip1sp\array@row@rst\cell@font\ignorespaces\@sharp\unskip\cell@fil}%
3252 }%
3253 \fi
3254 }%
3255 % \end{macrocode}
3256 % \end{macro}
3257 %
3258 % \begin{macro}{\@tabclassiv}
3259 % \begin{macrocode}
3260 \def\@tabclassiv@LaTeX{%
3261 \@addtopreamble\@nextchar
3262 }%
3263 \def\@tabclassiv@ltx{%
3264 \expandafter\@addtopreamble\expandafter{\@nextchar}%
3265 }%
3266 % \end{macrocode}
3267 % \end{macro}
3268 %
3269 % \begin{macro}{\@arrayclassiv}
3270 % \begin{macrocode}
3271 \def\@arrayclassiv@LaTeX{%
3272 \@addtopreamble{$\@nextchar$}%
3273 }%
3274 \def\@arrayclassiv@ltx{%
3275 \expandafter\@addtopreamble\expandafter{\expandafter$\@nextchar$}%
3276 }%
3277 % \end{macrocode}
3278 % \end{macro}
3279 %
3280 % \begin{macro}{\@classv}
3281 % \begin{macrocode}
3282 \def\@classv@LaTeX{%
3283 \@addtopreamble{\@startpbox{\@nextchar}\ignorespaces
3284 \@sharp\@endpbox}%
3285 }%
3286 \def\@classv@ltx{%
3287 \expandafter\@addtopreamble
3288 \expandafter{%
3289 \expandafter \@startpbox
3290 \expandafter {\@nextchar}%
3291 \pbox@hook\array@row@rst\cell@font\ignorespaces\@sharp\@endpbox
3292 }%
3293 }%
3294 % \end{macrocode}
3295 % \end{macro}
3296 %
3297 % \begin{macro}{\@classx}
3298 % \begin{macrocode}
3299 \def\@classx@array{%
3300 \ifcase \@lastchclass
3301 \@acolampacol \or
3302 \@addamp \@acol \or
3303 \@acolampacol \or
3304 \or
3305 \@acol \@firstampfalse \or
3306 \@addamp
3307 \fi
3308 }%
3309 \def\@classx@array@new{%
3310 \ifcase \@lastchclass
3311 \@acolampacol
3312 \or
3313 \@addamp \@acol
3314 \or
3315 \@acolampacol
3316 \or
3317 \or
3318 \@firstampfalse\@acoll
3319 \or
3320 \@addamp
3321 \fi
3322 }%
3323 % \end{macrocode}
3324 % \end{macro}
3325 %
3326 %
3327 % \subsection{Repair other broken parts of \LaTeX}
3328 %
3329 % \begin{macro}{\@xbitor}
3330 % Expansion part has extraneous space token. Removed.
3331 % \begin{macrocode}
3332 \def\@xbitor@LaTeX #1{\@tempcntb \count#1
3333 \ifnum \@tempcnta =\z@
3334 \else
3335 \divide\@tempcntb\@tempcnta
3336 \ifodd\@tempcntb \@testtrue\fi
3337 \fi}%
3338 \def\@xbitor@ltx#1{%
3339 \@tempcntb\count#1%
3340 \@ifnum{\@tempcnta=\z@}{}{%
3341 \divide\@tempcntb\@tempcnta
3342 \@ifodd\@tempcntb{\@testtrue}{}%
3343 }%
3344 }%
3345 \@ifx{\@xbitor\@xbitor@LaTeX}{%
3346 \class@info{Repairing broken LaTeX \string\@xbitor}%
3347 }{%
3348 \class@info{Unrecognized LaTeX \string\@xbitor. Please update this document class! (Proceeding with fingers crossed.)}%
3349 }%
3350 \let\@xbitor\@xbitor@ltx
3351 % \end{macrocode}
3352 % \end{macro}
3353 %
3354 %
3355 % \subsection{Syntax}
3356 % \begin{macro}{\@gobble@opt@one}
3357 % The \cmd\@gobble@opt@one\ command eats up an optional argument
3358 % and one required argument.
3359 % \begin{macrocode}
3360 \newcommand*\@gobble@opt@one[2][]{}%
3361 % \end{macrocode}
3362 % \end{macro}
3363 %
3364 % \subsection{Auto-indented Contents}
3365 % Facility to automatically determine the proper indentation of
3366 % the TOC entries.
3367 %
3368 % Note on \classname{hyperref} compatibility:
3369 % We must respect that
3370 % \cmd\contentsline now has a 4th argument.
3371 % So, instead of trying to override the meaning of \cmd\contentsline,
3372 % we use the aux file to remember max values from one run to the next.
3373 %
3374 % In this respect, this package retains compatability with
3375 % \classname{hyperref}.
3376 %
3377 % \begin{macro}{\@starttoc}
3378 % Install hooks at beginning and end of the TOC processing.
3379 % \begin{macrocode}
3380 \def\@starttoc#1{%
3381 \begingroup
3382 \toc@pre
3383 \makeatletter
3384 \@input{\jobname.#1}%
3385 \if@filesw
3386 \expandafter\newwrite\csname tf@#1\endcsname
3387 \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
3388 \fi
3389 \@nobreakfalse
3390 \toc@post
3391 \endgroup
3392 }%
3393 \def\toc@pre{}%
3394 \def\toc@post{}%
3395 % \end{macrocode}
3396 % \end{macro}
3397 %
3398 % \begin{macro}{\toc@@font}
3399 % Interface for setting the formatting characteristics of this part
3400 % of the TOC.
3401 %
3402 % Note: \cmd\toc@@font\ is the common font for all auto-sizing toc commands,
3403 % although this, too, could become a dispatcher.
3404 % \begin{macrocode}
3405 \def\toc@@font{}%{\footnotesize\rmfamily}%
3406 \def\@dotsep{\z@}%{5.5pt}%
3407 % \end{macrocode}
3408 % \end{macro}
3409 %
3410 % \begin{macro}{\l@section}
3411 % Interface for determining which TOC elements are automatically indented.
3412 %
3413 % All of the \cmd\l@\dots\ commands simply go through the
3414 % bottleproc \cmd\l@@sections. The calling convention is
3415 % to pass the name of self and the name of parent.
3416 % If you want to exclude any of these from the indentation
3417 % scheme, simply leave the \cmd\l@\dots\ command undefined.
3418 %
3419 % Note that the parent of ``section'' is nil, so we have to
3420 % define a stub.
3421 % \begin{verbatim}
3422 %\def\l@section{%
3423 % \l@@sections{}{section}% Implicit #3#4
3424 %}%
3425 %\def\tocleft@{\z@}%
3426 %\def\l@subsection{%
3427 % \l@@sections{section}{subsection}% Implicit #3#4
3428 %}%
3429 %\def\l@subsubsection{%
3430 % \l@@sections{subsection}{subsubsection}% Implicit #3#4
3431 %}%
3432 %\def\l@paragraph{%
3433 % \l@@sections{subsubsection}{paragraph}% Implicit #3#4
3434 %}%
3435 %\def\l@subparagraph#1#2{%
3436 % \l@@sections{paragraph}{subparagraph}% Implicit #3#4
3437 %}%
3438 % \end{verbatim}
3439 % \end{macro}
3440 %
3441 % Glom some \cmd\dimen\ registers.
3442 % \begin{macrocode}
3443 \let\tocdim@section \leftmargini
3444 \let\tocdim@subsection \leftmarginii
3445 \let\tocdim@subsubsection \leftmarginiii
3446 \let\tocdim@paragraph \leftmarginiv
3447 \let\tocdim@appendix \leftmarginv
3448 \let\tocdim@pagenum \leftmarginvi
3449 % \end{macrocode}
3450 %
3451 % \begin{macro}{\toc@pre@auto}
3452 % \begin{macro}{\toc@post@auto}
3453 % We patch \cmd\@starttoc\ to:
3454 % 1) before TOC processing,
3455 % initialize the max registers and
3456 % set the needed dimensions from
3457 % the values stored in the auxiliary file, and
3458 % 2) after TOC processing,
3459 % store out those max register values into the auxiliary file.
3460 %
3461 % Note that the font is set here: all other TOC entries must
3462 % override these font settings.
3463 %
3464 % To activate this override of the standard \LaTeX\ processing,
3465 % the substyle does: \cmd\let\cmd\toc@pre\cmd\toc@pre@auto\
3466 % and \cmd\let\cmd\toc@post\cmd\toc@post@auto.
3467 % \begin{macrocode}
3468 \def\toc@pre@auto{%
3469 \toc@@font
3470 \@tempdima\z@
3471 \toc@setindent\@tempdima{section}%
3472 \toc@setindent\@tempdima{subsection}%
3473 \toc@setindent\@tempdima{subsubsection}%
3474 \toc@setindent\@tempdima{paragraph}%
3475 \toc@letdimen{appendix}%
3476 \toc@letdimen{pagenum}%
3477 }%
3478 \def\toc@post@auto{%
3479 \if@filesw
3480 \begingroup
3481 \toc@writedimen{section}%
3482 \toc@writedimen{subsection}%
3483 \toc@writedimen{subsubsection}%
3484 \toc@writedimen{paragraph}%
3485 \toc@writedimen{appendix}%
3486 \toc@writedimen{pagenum}%
3487 \endgroup
3488 \fi
3489 }%
3490 % \end{macrocode}
3491 % \end{macro}
3492 % \end{macro}
3493 %
3494 % \begin{macro}{\toc@setindent}
3495 % \begin{macrocode}
3496 \def\toc@setindent#1#2{%
3497 \csname tocdim@#2\endcsname\tocdim@min\relax
3498 \@ifundefined{tocmax@#2}{\@namedef{tocmax@#2}{\z@}}{}%
3499 \advance#1\@nameuse{tocmax@#2}\relax
3500 \expandafter\edef\csname tocleft@#2\endcsname{\the#1}%
3501 }%
3502 % \end{macrocode}
3503 % \end{macro}
3504 %
3505 % \begin{macro}{\toc@letdimen}
3506 % \begin{macrocode}
3507 \def\toc@letdimen#1{%
3508 \csname tocdim@#1\endcsname\tocdim@min\relax
3509 \@ifundefined{tocmax@#1}{\@namedef{tocmax@#1}{\z@}}{}%
3510 \expandafter\let\csname tocleft@#1\expandafter\endcsname\csname tocmax@#1\endcsname
3511 }%
3512 % \end{macrocode}
3513 % \end{macro}
3514 %
3515 % \begin{macro}{\toc@writedimen}
3516 % \begin{macrocode}
3517 \def\toc@writedimen#1{%
3518 \immediate\write\@auxout{%
3519 \gdef\expandafter\string\csname tocmax@#1\endcsname{%
3520 \expandafter\the\csname tocdim@#1\endcsname
3521 }%
3522 }%
3523 }%
3524 % \end{macrocode}
3525 % \end{macro}
3526 %
3527 % \begin{macro}{\l@@sections}
3528 % The procedure for formatting the indented TOC entries.
3529 % We use control sequence names such as \cmd\tocmax@section\ and
3530 % \cmd\tocleft@section, the former being written to the auxiliary file
3531 % and the latter only defined for the duration of the TOC processing.
3532 %
3533 % Note that the assignment of \cmd\box\cmd\z@\ must endure
3534 % over the invocation of |#3|.
3535 % \begin{macrocode}
3536 \def\l@@sections#1#2#3#4{%
3537 % #1 - superior section
3538 % #2 - this section
3539 % #3 - content, including possible \numberline
3540 % #4 - page number
3541 \begingroup
3542 \everypar{}%
3543 \set@tocdim@pagenum{#4}%
3544 \global\@tempdima\csname tocdim@#2\endcsname
3545 \leftskip\csname tocleft@#2\endcsname\relax
3546 \dimen@\csname tocleft@#1\endcsname\relax
3547 \parindent-\leftskip\advance\parindent\dimen@
3548 \rightskip\tocleft@pagenum plus 1fil\relax
3549 \skip@\parfillskip\parfillskip\z@
3550 \let\numberline\numberline@@sections
3551 \@nameuse{l@f@#2}%
3552 \ignorespaces#3\unskip\nobreak\hskip\skip@
3553 \hb@xt@\rightskip{\hfil\unhbox\@tempboxa}\hskip-\rightskip\hskip\z@skip
3554 \par
3555 \expandafter\aftergroup\csname tocdim@#2\endcsname\expandafter
3556 \endgroup\the\@tempdima\relax
3557 }%
3558 \def\set@tocdim@pagenum#1{%
3559 \setbox\@tempboxa\hbox{\ignorespaces#1}%
3560 \@ifdim{\tocdim@pagenum<\wd\z@}{\global\tocdim@pagenum\wd\z@}{}%
3561 }%
3562 % \end{macrocode}
3563 % \end{macro}
3564 %
3565 % \begin{macro}{\numberline@@sections}
3566 % The bottleproc for all \cmd\numberline\ processing in indented TOC entries.
3567 % The first argument is self.
3568 %
3569 % We use \cmd\@tempdima\ to pass a value around (via global assignment) because
3570 % \cmd\numberline\ executes inside a group if the
3571 % \classname{hyperref} package is loaded.
3572 % Would that it were not so!
3573 % \begin{macrocode}
3574 \def\numberline@@sections#1{%
3575 \leavevmode\hb@xt@-\parindent{%
3576 \hfil
3577 \@if@empty{#1}{}{%
3578 \setbox\z@\hbox{#1.\kern\@dotsep}%
3579 \@ifdim{\@tempdima<\wd\z@}{\global\@tempdima\wd\z@}{}%
3580 \unhbox\z@
3581 }%
3582 }%
3583 \ignorespaces
3584 }%
3585 \def\tocdim@min{\z@}%
3586 % \end{macrocode}
3587 % \end{macro}
3588 %
3589 %
3590 % \subsection{Lists}
3591 % \begin{macro}{\list}
3592 % Using \cmd\parshape\ to implement lists was always suspect
3593 % (can you get behind \cmd\parshape\cmd\@ne?) and we now see that
3594 % it was a mistake all along. Why? Because \cmd\parshape, like
3595 % \cmd\hangindent, achieves its effect via ``shifting'' the \cmd\hbox es
3596 % in a paragraph
3597 % instead of using \cmd\leftskip\ and \cmd\parindent, which is
3598 % robust during column balancing.
3599 %
3600 % We introduce the alternative method with a hook into
3601 % the \LaTeX\ kernel procedure \cmd\list, which is
3602 % the implementation of all lists.
3603 %
3604 % \begin{macrocode}
3605 \def\list#1#2{%
3606 \ifnum \@listdepth >5\relax
3607 \@toodeep
3608 \else
3609 \global\advance\@listdepth\@ne
3610 \fi
3611 \rightmargin\z@
3612 \listparindent\z@
3613 \itemindent\z@
3614 \csname @list\romannumeral\the\@listdepth\endcsname
3615 \def\@itemlabel{#1}%
3616 \let\makelabel\@mklab
3617 \@nmbrlistfalse
3618 #2\relax
3619 \@trivlist
3620 \parskip\parsep
3621 \set@listindent
3622 \ignorespaces
3623 }%
3624 \def\set@listindent@parshape{%
3625 \parindent\listparindent
3626 \advance\@totalleftmargin\leftmargin
3627 \advance\linewidth-\rightmargin
3628 \advance\linewidth-\leftmargin
3629 \parshape\@ne\@totalleftmargin\linewidth
3630 }%
3631 \def\set@listindent@{%
3632 \parindent\listparindent
3633 \advance\@totalleftmargin\leftmargin
3634 \advance\rightskip\rightmargin
3635 \advance\leftskip\@totalleftmargin
3636 }%
3637 \let\set@listindent\set@listindent@parshape
3638 % \end{macrocode}
3639 % \end{macro}
3640 %
3641 % \subsection{End of the \file{ltxutil} {\sc docstrip} module}
3642 % Here ends the module.
3643 % \begin{macrocode}
3644 %</ltxutil-krn>
3645 % \end{macrocode}
3646 %
3647 %
3648 % \Finale
3649 % %Here ends the programmer's documentation.
3650 % \endinput
3651 %
3652 \endinput
3653 %%EOF