Debian Codegraph @

texmf-dist/source/latex/base/ltboxes.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 1993-2025
4 % The LaTeX Project and any individual authors listed elsewhere
5 % in this file.
6 %
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
9 %
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % https://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2008 or later.
17 %
18 % This file has the LPPL maintenance status "maintained".
19 %
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
22 % information.
23 %
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
27 %
28 % \fi
29 %
30 % \iffalse
31 %%% From File: ltboxes.dtx
32 %
33 %<*driver>
34 % \fi
35 \ProvidesFile{ltboxes.dtx}
36 [2024/06/23 v1.4h LaTeX Kernel (Box Commands)]
37 % \iffalse
38 \documentclass{ltxdoc}
39 \GetFileInfo{ltboxes.dtx}
40 \title{\filename}
41 \date{\filedate}
42 \author{David Carlisle\and
43 Leslie Lamport\and
44 Frank Mittelbach\and
45 Chris Rowley}
46 \begin{document}
47 \MaintainedByLaTeXTeam{latex}
48 \maketitle
49 \DocInput{\filename}
50 \end{document}
51 %</driver>
52 % \fi
53 %
54 %
55 % \changes{v1.1e}{1998/08/17}{(RmS) Minor Documentation fixes.}
56 % \changes{v1.3b}{2019/08/27}{Various commands made robust}
57 %
58 %
59 %
60 % \section{\LaTeX\ Box commands}
61 %
62 %
63 % \DescribeMacro\makebox
64 % |\makebox[|\meta{wid}|][|\meta{pos}|]{|\meta{obj}|}|\\
65 % Puts \meta{obj} in an |\hbox| of width \meta{wid}, positioned by
66 % \meta{pos}.
67 %
68 % The possible \meta{pos} are:\\
69 % \begin{tabular}{ll}
70 % |s| stretched,\\
71 % |l| flushleft,\\
72 % |r| flushright,\\
73 % |c| (default) centred.
74 % \end{tabular}
75 %
76 % If \meta{wid} is missing, then \meta{pos} is also missing and
77 % \meta{obj} is put in an |\hbox| of its natural width.
78 %
79 % |\makebox(|\meta{x}|,|\meta{y}|)[|\meta{pos}|]{|\meta{obj}|}|\\
80 % Puts \meta{obj} in an |\hbox| of width $x * |\unitlength|$
81 % and height $y * |\unitlength|$.
82 % \meta{pos} arguments are
83 % |s|, |l|, |r| or |c| (default) for stretched, flushleft, flushright
84 % or centred, and |t| or |b|
85 % for top, bottom -- or combinations like |tr| or |rb|.
86 % Default for horizontal and vertical are centered.
87 % Note that in this picture mode version of |\makebox| a [b] aligns on
88 % the \emph{bottom} of the text as documented. If you want to align on
89 % the \emph{baseline} use
90 % |\makebox( , )[b]{\raisebox{0pt}[\height][0pt]{xyz}}|
91 % or |\makebox( , )[b]{\smash{xyz}}|
92 %
93 % \DescribeMacro\mbox
94 % |\mbox{|\meta{obj}|}| The same as |\makebox{|\meta{obj}|}|, but is
95 % more efficient as no checking for optional arguments is done.
96 %
97 % \DescribeMacro\newsavebox
98 % |\newsavebox{\cmd}| : If |\cmd| is undefined, then defines it
99 % to be a \TeX\ box register.
100 %
101 % \DescribeMacro\savebox
102 % |\savebox{\cmd}| ... : |\cmd| is defined to be a \TeX\ box register,
103 % and the '...' are any |\makebox| arguments. It is
104 % like |\makebox|, except it doesn't produce text but
105 % saves the value in |\box| |\cmd|.
106 %
107 % \DescribeMacro\sbox
108 % |\sbox{|\meta{cmd}|}{|\meta{obj}|}| is an efficient abbreviation for\\
109 % |\savebox{|\meta{cmd}|}{|\meta{obj}|}|.
110 %
111 % \DescribeEnv{lrbox}
112 % |\begin{lrbox}{|\meta{cmd}|}|\meta{text}|\end{lrbox}| is equivalent
113 % to\\
114 % |\sbox{|\meta{cmd}|}{|\meta{text}|}|\\
115 % except that any white space at the beginning and end of \meta{text}
116 % is ignored.
117 %
118 % \DescribeMacro\framebox
119 % |\framebox| ... : like |\makebox|, except it puts a `frame' around
120 % the box. The frame is made of lines of thickness
121 % |\fboxrule|, separated by space |\fboxsep| from the
122 % text -- except for |\framebox(X,Y)| ... , where the
123 % thickness of the lines is as for the picture environment,
124 % and there is no separation added.
125 %
126 % \DescribeMacro\fbox
127 % |\fbox{|\meta{obj}|}| is an abbreviation for
128 % |\framebox{|\meta{obj}|}|.
129 %
130 % \DescribeMacro\parbox
131 % |\parbox[|\meta{pos}|][|\meta{height}|][|\meta{inner-pos}|]{|^^A
132 % \meta{width}|}{|\meta{text}|}| :
133 % Makes a box with |\hsize| \meta{width}, positioned by \meta{pos} as
134 % follows:
135 % c : |\vcenter| (placed in |$...$| if not in math mode)
136 % b : |\vbox|
137 % t : |\vtop|
138 % default value is c.
139 % Sets |\hsize| := \meta{width} and calls |\@parboxrestore|, which
140 % does the following:
141 % Restores the original definitions of:
142 %
143 % \begin{tabular}{l}
144 % |\par|\\
145 % |\\|\\
146 % |\-|\\
147 % |\'|\\
148 % | \`|\\
149 % |\=|
150 % \end{tabular}
151 %
152 % Resets the following parameters:
153 %
154 % \begin{tabular}{l@{\quad=\quad}ll}
155 % |\parindent| & 0pt \\
156 % |\parskip| & 0pt & added 20 Jan 87\\
157 % |\linewidth| & |\hsize|\\
158 % |\@totalleftmargin| & 0pt\\
159 % |\leftskip| & 0pt\\
160 % |\rightskip| & 0pt\\
161 % |\@rightskip| & 0pt\\
162 % |\parfillskip| & 0pt plus 1fil\\
163 % |\lineskip| & |\normallineskip|\\
164 % |\baselineskip| & |\normalbaselineskip|
165 % \end{tabular}
166 %
167 % Calls |\sloppy|
168 %
169 % Note: |\@arrayparboxrestore| same as |\@parboxrestore|
170 % but it doesn't restore |\\|.
171 %
172 % \DescribeEnv{minipage}
173 % |minipage| : Similar to |\parbox|, except it also
174 % makes this look like a page by setting
175 %
176 % |\textwidth| == |\columnwidth| == box width
177 %
178 % changes footnotes by redefining:\\%
179 % |\@mpfn| == mpfootnote \\
180 % |\thempfn| == |\thempfootnote|\\
181 % |\@footnotetext| == |\@mpfootnotetext|
182 %
183 % resets the following list environment parameters:\\
184 % |\@listdepth| == |\@mplistdepth|\\
185 % where |\@mplistdepth| is initialized to zero,
186 %
187 % and executes |\@minipagerestore| to allow the document
188 % style to reset any other parameters it desires.
189 % It sets |@minipage| true, and resets |\everypar| to set
190 % it false. This switch keeps |\addvspace| from putting space
191 % at the top of a minipage.
192 %
193 % Change added 24 May 89: |\minipage| sets |@minipage| globally;
194 % |\endminipage| resets it false.
195 %
196 %
197 % \DescribeMacro\rule
198 % |\rule[|\meta{raised}|]{|\meta{width}|}{|\meta{height}|}| :
199 % Makes a $\meta{width}*\meta{height}$ rule, raised \meta{raised}.
200 %
201 % \DescribeMacro\underline
202 % |\underline{|\meta{text}|}| : Makes an underlined hbox with
203 % \meta{text} in it.
204 %
205 % \DescribeMacro\raisebox
206 % |\raisebox{|\meta{distance}|}[|\meta{height}|][|\meta{depth}^^A
207 % |]{|\meta{box}|}| :\\
208 % Raises \meta{box} up by \meta{distance} length (down if
209 % \meta{distance} negative). Makes \TeX\ think that the new box extends
210 % \meta{height} above the line and \meta{depth} below, for a total
211 % vertical length of \meta{height}+\meta{depth}. Default values of
212 % \meta{height} \& \meta{depth} = actual height and depth of box in new
213 % position.
214 %
215 % \MaybeStop{}
216 %
217 % \changes{v0.1e}{1994/03/02}{Remove need for drv file}
218 % \changes{v0.1e}{1994/03/02}{Add 2ekernel module}
219 % \changes{v1.0a}{1994/03/07}{Unify format with other Kernel files}
220 % \changes{v1.0f}{1994/05/11}
221 % {Superfluous braces removed from several commands}
222 % \changes{v1.0j}{1994/10/18}
223 % {stuff from ltpatch done}
224 % \changes{v1.0p}{1994/11/09}
225 % {more color changes\ldots}
226 % \changes{v1.0q}{1994/11/17}
227 % {\cs{@tempa} to \cs{reserved@a}}
228 % \changes{v1.0t}{1995/05/07}{Use \cs{hb@xt@}}
229 % \changes{v1.0w}{1995/10/16}{Clarify makebox description}
230 % \begin{macrocode}
231 %<*2ekernel>
232 \message{boxes,}
233 % \end{macrocode}
234 %
235 % \begin{macro}{\makebox}
236 % \changes{v0.1a}{1993/12/03}
237 % {modified}
238 % |\makebox| User level command just looks for optional
239 % |[| or |(|. \iffalse)]\fi
240 % \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
241 % \begin{macrocode}
242 %</2ekernel>
243 %<latexrelease>\IncludeInRelease{2015/01/01}%
244 %<latexrelease> {\makebox}{Make \makebox robust}%
245 %<*2ekernel|latexrelease>
246 \DeclareRobustCommand\makebox{%
247 \leavevmode
248 \@ifnextchar(%)
249 \@makepicbox
250 {\@ifnextchar[\@makebox\mbox}}%
251 %</2ekernel|latexrelease>
252 %<latexrelease>\EndIncludeInRelease
253 %<latexrelease>\IncludeInRelease{0000/00/00}%
254 %<latexrelease> {\makebox}{Make \makebox robust}%
255 %<latexrelease>\def\makebox{%
256 %<latexrelease> \leavevmode
257 %<latexrelease> \@ifnextchar(%)
258 %<latexrelease> \@makepicbox
259 %<latexrelease> {\@ifnextchar[\@makebox\mbox}}%
260 %<latexrelease>\expandafter\let\csname makebox \endcsname\@undefined
261 %<latexrelease>\EndIncludeInRelease
262 %<*2ekernel>
263 % \end{macrocode}
264 % \end{macro}
265 %
266 % \begin{macro}{\mbox}
267 % \changes{v0.1a}{1993/12/03}
268 % {extra group}
269 % \changes{v1.0j}{1994/10/18}
270 % {\cs{long} added}
271 % The basic horizontal box command for \LaTeX.
272 % \begin{macrocode}
273 \DeclareRobustCommand\mbox[1]{\leavevmode\hbox{#1}}
274 % \end{macrocode}
275 % \end{macro}
276 %
277 % \begin{macro}{\@makebox}
278 % \changes{v0.1a}{1993/12/03}
279 % {default changed from x to c}
280 % Look for a possible second optional argument (defaults to |c|).
281 % \begin{macrocode}
282 \def\@makebox[#1]{%
283 \@ifnextchar [{\@imakebox[#1]}{\@imakebox[#1][c]}}
284 % \end{macrocode}
285 % \end{macro}
286 %
287 %
288 % \begin{macro}{\@begin@tempboxa}
289 % \changes{v0.1a}{1993/12/03}
290 % {macro added}
291 % \changes{v0.1b}{1993/12/08}
292 % {Extra braces for color support
293 % (braces removed from other macros)}
294 % \changes{v1.0f}{1994/05/11}
295 % {Use new \cs{color@setgroup} concept.}
296 % Helper macro for supporting |\height|, |\width| etc. Grab |#1| into
297 % |\@tempboxa| and measure it.
298 % \begin{macrocode}
299 \long\def\@begin@tempboxa#1#2{%
300 \begingroup
301 \setbox\@tempboxa#1{\color@begingroup#2\color@endgroup}%
302 \def\width{\wd\@tempboxa}%
303 \def\height{\ht\@tempboxa}%
304 \def\depth{\dp\@tempboxa}%
305 \let\totalheight\@ovri
306 \totalheight\height
307 \advance\totalheight\depth}
308 % \end{macrocode}
309 % \end{macro}
310 %
311 % \begin{macro}{\@end@tempboxa}
312 % \changes{v0.1a}{1993/12/03}
313 % {macro added}
314 % End the group started by |\@begin@tempboxa|, so that the scope of
315 % |\height| only includes the `length' argument to the user-command.
316 % \begin{macrocode}
317 \let\@end@tempboxa\endgroup
318 % \end{macrocode}
319 % \end{macro}
320 %
321 % \begin{macro}{\bm@c}
322 % \begin{macro}{\bm@l}
323 % \begin{macro}{\bm@r}
324 % \begin{macro}{\bm@s}
325 % \begin{macro}{\bm@t}
326 % \begin{macro}{\bm@b}
327 % \changes{v0.1a}{1993/12/03}
328 % {macros added}
329 % Set up spacing.
330 % \begin{macrocode}
331 \def\bm@c{\hss\unhbox\@tempboxa\hss}
332 \def\bm@l{\unhbox\@tempboxa\hss}\let\bm@t\bm@l
333 \def\bm@r{\hss\unhbox\@tempboxa}\let\bm@b\bm@r
334 \def\bm@s{\unhbox\@tempboxa}
335 % \end{macrocode}
336 % \end{macro}
337 % \end{macro}
338 % \end{macro}
339 % \end{macro}
340 % \end{macro}
341 % \end{macro}
342 %
343 % \begin{macro}{\@imakebox}
344 % \changes{v0.1a}{1993/12/03}
345 % {macro modified}
346 % \changes{v1.4e}{2023/10/26}
347 % {Guard against unknown alignment gh/1072}
348 % Internal form of |\makebox|.
349 % \begin{macrocode}
350 %</2ekernel>
351 %<latexrelease>\IncludeInRelease{2023/11/01}%
352 %<latexrelease> {\@imakebox}{Unknown alignment warning}%
353 %<*2ekernel|latexrelease>
354 \long\def\@imakebox[#1][#2]#3{%
355 \@begin@tempboxa\hbox{#3}%
356 \setlength\@tempdima{#1}% support calc
357 \hb@xt@\@tempdima{%
358 \expandafter\ifx\csname bm@#2\endcsname\relax
359 \bm@c
360 \@latex@warning{Unexpected alignment #2}%
361 \else
362 \csname bm@#2\endcsname
363 \fi}%
364 \@end@tempboxa}
365 %</2ekernel|latexrelease>
366 %<latexrelease>\EndIncludeInRelease
367 %<latexrelease>\IncludeInRelease{0000/00/00}%
368 %<latexrelease> {\@imakebox}{Unknown alignment warning}%
369 %<latexrelease>\long\def\@imakebox[#1][#2]#3{%
370 %<latexrelease> \@begin@tempboxa\hbox{#3}%
371 %<latexrelease> \setlength\@tempdima{#1}% support calc
372 %<latexrelease> \hb@xt@\@tempdima{\csname bm@#2\endcsname}%
373 %<latexrelease> \@end@tempboxa}
374 %<latexrelease>\EndIncludeInRelease
375 %<*2ekernel>
376 % \end{macrocode}
377 % \end{macro}
378 %
379 % \begin{macro}{\@makepicbox}
380 % \changes{v0.1a}{1993/12/03}
381 % {macro modified}
382 % Picture mode form of |\makebox|.
383 % \begin{macrocode}
384 \def\@makepicbox(#1,#2){%
385 \@ifnextchar[{\@imakepicbox(#1,#2)}{\@imakepicbox(#1,#2)[]}}
386 % \end{macrocode}
387 % \end{macro}
388 %
389 % \begin{macro}{\@imakepicbox}
390 % picture mode version
391 % \begin{macrocode}
392 %</2ekernel>
393 %<*2ekernel|latexrelease>
394 %<latexrelease>\IncludeInRelease{2020/10/01}%
395 %<latexrelease> {\@imakepicbox}{default units}%
396 \long\def\@imakepicbox(#1,#2)[#3]#4{%
397 \@defaultunitsset\@tempdimc{#2}\unitlength
398 \vbox to\@tempdimc
399 {\let\mb@b\vss \let\mb@l\hss\let\mb@r\hss
400 \let\mb@t\vss
401 \@tfor\reserved@a :=#3\do{%
402 \if s\reserved@a
403 \let\mb@l\relax\let\mb@r\relax
404 \else
405 \expandafter\let\csname mb@\reserved@a\endcsname\relax
406 \fi}%
407 \mb@t
408 \@defaultunitsset\@tempdimc{#1}\unitlength
409 \hb@xt@\@tempdimc{\mb@l #4\mb@r}%
410 \mb@b
411 % \end{macrocode}
412 % This kern ensures that a |b| option aligns on the bottom of the
413 % text rather than the baseline. this is the documented behaviour in
414 % the \LaTeX\ Book. The kern is removed in compatibility mode.
415 % \begin{macrocode}
416 \kern\z@}}
417 %</2ekernel|latexrelease>
418 % \end{macrocode}
419 %
420 % \begin{macrocode}
421 %<latexrelease>\EndIncludeInRelease
422 %<latexrelease>\IncludeInRelease{0000/00/00}%
423 %<latexrelease> {\@imakepicbox}{default units}%
424 %<latexrelease>\long\def\@imakepicbox(#1,#2)[#3]#4{%
425 %<latexrelease> \vbox to#2\unitlength
426 %<latexrelease> {\let\mb@b\vss \let\mb@l\hss\let\mb@r\hss
427 %<latexrelease> \let\mb@t\vss
428 %<latexrelease> \@tfor\reserved@a :=#3\do{%
429 %<latexrelease> \if s\reserved@a
430 %<latexrelease> \let\mb@l\relax\let\mb@r\relax
431 %<latexrelease> \else
432 %<latexrelease> \expandafter\let\csname mb@\reserved@a\endcsname\relax
433 %<latexrelease> \fi}%
434 %<latexrelease> \mb@t
435 %<latexrelease> \hb@xt@ #1\unitlength{\mb@l #4\mb@r}%
436 %<latexrelease> \mb@b
437 %<latexrelease> \kern\z@}}
438 %<latexrelease>\EndIncludeInRelease
439 %<*2ekernel>
440 % \end{macrocode}
441 % \end{macro}
442 %
443 %
444 % \begin{macro}{\set@color}
445 % \changes{v0.1a}{1993/12/03}
446 % {macro added}
447 % \changes{v0.1a}{1993/12/03}
448 % {color support}
449 % This macro is initially a no-op, but the color package will redefine
450 % it to insert a |\special|.
451 % \begin{macrocode}
452 \let\set@color\relax
453 % \end{macrocode}
454 % \end{macro}
455 %
456 % \begin{macro}{\color@begingroup}
457 % \changes{v1.0b}{1994/03/14}
458 % {macro added for color support}
459 % \begin{macro}{\color@setgroup}
460 % \changes{v1.0f}{1994/05/11}
461 % {macro added for color support}
462 % \begin{macro}{\normalcolor}
463 % \changes{v1.0g}{1994/05/12}
464 % {macro added for color support}
465 % \begin{macro}{\color@hbox}
466 % \changes{v1.0n}{1994/11/05}
467 % {macro added for color support}
468 % \begin{macro}{\color@vbox}
469 % \changes{v1.0r}{1994/11/18}
470 % {macro added for color support}
471 % \begin{macro}{\color@endbox}
472 % \changes{v1.0n}{1994/11/05}
473 % {macro added for color support}
474 % \changes{v1.4b}{2021/02/04}
475 % {Always add the color groups (gh/488)}
476 % In the past these macros were initially no-ops, and the \pkg{color}
477 % package redefined
478 % redefine them to be |\begingroup|, |\endgroup|,
479 % |\begingroup\set@color|,\\ |\hbox\bgroup\color@begingroup|,
480 % |\color@endgroup\egroup|.
481 % and \meta{set to main document color} respectively.
482 %
483 % Nowadays we always set the group already in the kernel as this makes the
484 % coding simpler.
485 % \begin{macrocode}
486 %</2ekernel>
487 %<*2ekernel|latexrelease>
488 %<latexrelease>\IncludeInRelease{2021/06/01}%
489 %<latexrelease> {\color@begingroup}{color group settings}%
490 \let\color@begingroup\begingroup
491 \def\color@setgroup{\color@begingroup} % changed further in color package
492 \let\normalcolor\relax % remains untouched; only changed in a color package
493 \def\color@hbox{\hbox\bgroup\color@begingroup}
494 \def\color@vbox{\vbox\bgroup\color@begingroup}
495 \def\color@endbox{\color@endgroup\egroup}
496 %</2ekernel|latexrelease>
497 %<latexrelease>\EndIncludeInRelease
498 % \end{macrocode}
499 %
500 % \begin{macrocode}
501 %<latexrelease>\IncludeInRelease{0000/00/00}%
502 %<latexrelease> {\color@begingroup}{color group settings}%
503 %<latexrelease>
504 %<latexrelease>\let\color@begingroup\relax
505 %<latexrelease>\let\color@setgroup\relax
506 %<latexrelease>\let\normalcolor\relax
507 %<latexrelease>\let\color@hbox\relax
508 %<latexrelease>\let\color@vbox\relax
509 %<latexrelease>\let\color@endbox\relax
510 %<latexrelease>
511 %<latexrelease>\EndIncludeInRelease
512 %<*2ekernel>
513 % \end{macrocode}
514 % \end{macro}
515 % \end{macro}
516 % \end{macro}
517 % \end{macro}
518 % \end{macro}
519 % \end{macro}
520
521
522
523 % \begin{macro}{\color@endgroup}
524 % This macro is separated out because it received an update in 2024,
525 % so requires its own rollback.
526 % \changes{v1.0b}{1994/03/14}
527 % {macro added for color support}
528 % \begin{macrocode}
529 %</2ekernel>
530 %<*2ekernel|latexrelease>
531 %<latexrelease>\IncludeInRelease{2024/11/01}%
532 %<latexrelease> {\color@endgroup}{color group settings}%
533 % \end{macrocode}
534 % Beside \cs{endgraf} for handling vertical boxes we also reset
535 % \cs{if@endpe} as we are leaving the context.
536 % \changes{v1.4h}{2024/06/23}{Adjust for new \texttt{@endpe} handling}
537 % \begin{macrocode}
538 \def\color@endgroup{\endgraf\@endpefalse\endgroup}
539 %<latexrelease>
540 %</2ekernel|latexrelease>
541 %<latexrelease>\EndIncludeInRelease
542 % \end{macrocode}
543 %
544 % \begin{macrocode}
545 %<latexrelease>\IncludeInRelease{2021/06/01}%
546 %<latexrelease> {\color@endgroup}{color group settings}%
547 %<latexrelease>\def\color@endgroup{\endgraf\endgroup}
548 %<latexrelease>
549 %<latexrelease>\EndIncludeInRelease
550 % \end{macrocode}
551 %
552 % \begin{macrocode}
553 %<latexrelease>\IncludeInRelease{0000/00/00}%
554 %<latexrelease> {\color@endgroup}{color group settings}%
555 %<latexrelease>
556 %<latexrelease>\let\color@endgroup\relax
557 %<latexrelease>
558 %<latexrelease>\EndIncludeInRelease
559 %<*2ekernel>
560 % \end{macrocode}
561 % \end{macro}
562
563
564
565 %
566 % \begin{macro}{\newsavebox}
567 % \changes{v0.1a}{1993/12/03}
568 % {Pass the whole of arg 1 to \cs{@ifdefinable}}
569 % Allocate a new `savebox'.
570 % \begin{macrocode}
571 \def\newsavebox#1{\@ifdefinable{#1}{\newbox#1}}
572 % \end{macrocode}
573 % \end{macro}
574 %
575 % \begin{macro}{\savebox}
576 % Save |#1| in a box register.
577 % \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
578 % \begin{macrocode}
579 %</2ekernel>
580 %<latexrelease>\IncludeInRelease{2015/01/01}%
581 %<latexrelease> {\savebox}{Make \savebox robust}%
582 %<*2ekernel|latexrelease>
583 \DeclareRobustCommand\savebox[1]{%
584 \@ifnextchar(%)
585 {\@savepicbox#1}{\@ifnextchar[{\@savebox#1}{\sbox#1}}}%
586 %</2ekernel|latexrelease>
587 %<latexrelease>\EndIncludeInRelease
588 %<latexrelease>\IncludeInRelease{0000/00/00}%
589 %<latexrelease> {\savebox}{Make \savebox robust}%
590 %<latexrelease>\def\savebox#1{%
591 %<latexrelease> \@ifnextchar(%)
592 %<latexrelease> {\@savepicbox#1}{\@ifnextchar[{\@savebox#1}{\sbox#1}}}%
593 %<latexrelease>\expandafter\let\csname savebox \endcsname\@undefined
594 %<latexrelease>\EndIncludeInRelease
595 %<*2ekernel>
596 % \end{macrocode}
597 % \end{macro}
598 %
599 % \begin{macro}{\sbox}
600 % \changes{v0.1a}{1993/12/03}
601 % {extra group}
602 % \changes{v0.1a}{1993/12/03}
603 % {color support}
604 % \changes{v1.0b}{1994/03/14}
605 % {Use \cs{color@setgroup}}
606 % \changes{v1.0j}{1994/10/18}
607 % {\cs{long} added}
608 % Save |#1| in a box register.
609 % \begin{macrocode}
610 \DeclareRobustCommand\sbox[2]{\setbox#1\hbox{%
611 \color@setgroup#2\color@endgroup}}
612 % \end{macrocode}
613 % \end{macro}
614 %
615 % \begin{macro}{\@savebox}
616 % \changes{v0.1a}{1993/12/03}
617 % {default c not x}
618 % Look for second optional argument.
619 % \begin{macrocode}
620 \def\@savebox#1[#2]{%
621 \@ifnextchar [{\@isavebox#1[#2]}{\@isavebox#1[#2][c]}}
622 % \end{macrocode}
623 % \end{macro}
624 %
625 % \begin{macro}{\@isavebox}
626 % \changes{v0.1a}{1993/12/03}
627 % {extra group}
628 % \changes{v0.1a}{1993/12/03}
629 % {color support}
630 % \changes{v1.0b}{1994/03/14}
631 % {Use \cs{color@setgroup}}
632 % \changes{v1.0d}{1994/04/15}
633 % {Added missing percent character.}
634 % \changes{v1.0v}{1995/07/20}
635 % {Use \cs{sbox}}
636 % \begin{macrocode}
637 \long\def\@isavebox#1[#2][#3]#4{%
638 \sbox#1{\@imakebox[#2][#3]{#4}}}
639 % \end{macrocode}
640 % \end{macro}
641 %
642 % \begin{macro}{\@savepicbox}
643 % Picture mode version of |\savebox|.
644 % \begin{macrocode}
645 \def\@savepicbox#1(#2,#3){%
646 \@ifnextchar[%]
647 {\@isavepicbox#1(#2,#3)}{\@isavepicbox#1(#2,#3)[]}}
648 % \end{macrocode}
649 % \end{macro}
650 %
651 % \begin{macro}{\@isavepicbox}
652 % \changes{v0.1a}{1993/12/03}
653 % {extra group}
654 % \changes{v1.0b}{1994/03/14}
655 % {Use \cs{color@setgroup}}
656 % \changes{v1.0l}{1994/10/25}
657 % {missing percent (moved from ltpatch)}
658 % \changes{v1.0v}{1995/07/20}
659 % {Use \cs{sbox}}
660 % Picture mode version of |\savebox|.
661 % \begin{macrocode}
662 \long\def\@isavepicbox#1(#2,#3)[#4]#5{%
663 \sbox#1{\@imakepicbox(#2,#3)[#4]{#5}}}
664 % \end{macrocode}
665 % \end{macro}
666 %
667 % \begin{macro}{\lrbox}
668 % \changes{v0.1a}{1993/12/03}
669 % {macro added}
670 % \changes{v0.1a}{1993/12/03}
671 % {color support}
672 % \changes{v0.1b}{1993/12/08}
673 % {move \cs{@endpefalse} out of the inner group}
674 % \changes{v1.0b}{1994/03/14}
675 % {Use \cs{color@setgroup}}
676 % |lrbox|: the new environment form of |\sbox|. Use |\aftergroup| tricks
677 % to enable a \emph{local} assignment to be made to the box, in a way
678 % that it still has an effect \emph{outside} the |lrbox| environment.
679 % \begin{macrocode}
680 \def\lrbox#1{%
681 \edef\reserved@a{%
682 \endgroup
683 \setbox#1\hbox{%
684 \begingroup\aftergroup}%
685 \def\noexpand\@currenvir{\@currenvir}%
686 \def\noexpand\@currenvline{\on@line}}%
687 \reserved@a
688 \@endpefalse
689 \color@setgroup
690 \ignorespaces}
691 % \end{macrocode}
692 % \end{macro}
693 %
694 % \begin{macro}{\endlrbox}
695 % \changes{v0.1a}{1993/12/03}
696 % {macro added}
697 % End the |lrbox| environment.
698 % \begin{macrocode}
699 \def\endlrbox{\unskip\color@endgroup}
700 % \end{macrocode}
701 % \end{macro}
702 %
703 % \begin{macro}{\usebox}
704 % unchanged
705 % \begin{macrocode}
706 \DeclareRobustCommand\usebox[1]{\leavevmode\copy #1\relax}
707 % \end{macrocode}
708 % \end{macro}
709 %
710 % \begin{macro}{\frame}
711 %
712 % The following definition of |\frame| was written by Pavel Curtis
713 % (Extra space removed 14 Jan 88)
714 % RmS 92/08/24: Replaced occurrence of |\@halfwidth| by |\@wholewidth|
715 % \begin{macrocode}
716 \DeclareRobustCommand\frame[1]{%
717 \leavevmode
718 \hbox{%
719 \hskip-\@wholewidth
720 \vbox{%
721 \vskip-\@wholewidth
722 \hrule \@height\@wholewidth
723 \hbox{%
724 \vrule\@width\@wholewidth
725 #1%
726 \vrule\@width\@wholewidth}%
727 \hrule\@height\@wholewidth
728 \vskip-\@wholewidth}%
729 \hskip-\@wholewidth}}
730 % \end{macrocode}
731 % \end{macro}
732 %
733 % \begin{macro}{\fboxrule}
734 % \begin{macro}{\fboxsep}
735 % user level parameters,
736 % \begin{macrocode}
737 \newdimen\fboxrule
738 \newdimen\fboxsep
739 % \end{macrocode}
740 % \end{macro}
741 % \end{macro}
742 %
743 % \begin{macro}{\fbox}
744 % Abbreviated framed box command.
745 % \changes{v0.1a}{1993/12/03}
746 % {extra group}
747 % \changes{v1.0g}{1994/05/12}
748 % {New definition, merged with \cs{framebox}}
749 % \changes{v1.0i}{1994/06/01}
750 % {New version, using \cs{@frameb@x}}
751 % \changes{v1.0j}{1994/10/18}
752 % {\cs{long} added}
753 % \changes{v1.0k}{1994/10/24}
754 % {Inner braces added (to fix latex/1061)}
755 % \changes{v1.0s}{1995/04/27}
756 % {Move \cs{leavevmode} for graphics/1512}
757 % \begin{macrocode}
758 \DeclareRobustCommand\fbox[1]{%
759 \leavevmode
760 \setbox\@tempboxa\hbox{%
761 \color@begingroup
762 \kern\fboxsep{#1}\kern\fboxsep
763 \color@endgroup}%
764 \@frameb@x\relax}
765 % \end{macrocode}
766 % \end{macro}
767 %
768 % \begin{macro}{\framebox}
769 % Framed version of |\makebox|.
770 % \changes{v1.0g}{1994/05/12}
771 % {Merged \cs{fbox} and \cs{framebox}}
772 % \changes{v1.0i}{1994/06/01}
773 % {New version, so \cs{width} is correct in \cs{framebox}}
774 % \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
775 % \begin{macrocode}
776 %</2ekernel>
777 %<latexrelease>\IncludeInRelease{2015/01/01}%
778 %<latexrelease> {\framebox}{Make \framebox robust}%
779 %<*2ekernel|latexrelease>
780 \DeclareRobustCommand\framebox{%
781 \@ifnextchar(%)
782 \@framepicbox{\@ifnextchar[\@framebox\fbox}}%
783 %</2ekernel|latexrelease>
784 %<latexrelease>\EndIncludeInRelease
785 %<latexrelease>\IncludeInRelease{0000/00/00}%
786 %<latexrelease> {\framebox}{Make \framebox robust}%
787 %<latexrelease>\def\framebox{%
788 %<latexrelease> \@ifnextchar(%)
789 %<latexrelease> \@framepicbox{\@ifnextchar[\@framebox\fbox}}%
790 %<latexrelease>\expandafter\let\csname framebox \endcsname\@undefined
791 %<latexrelease>\EndIncludeInRelease
792 %<*2ekernel>
793 % \end{macrocode}
794 % \end{macro}
795 %
796 % \begin{macro}{\@framebox}
797 % Deal with optional arguments.
798 % \begin{macrocode}
799 \def\@framebox[#1]{%
800 \@ifnextchar[%]
801 {\@iframebox[#1]}%
802 {\@iframebox[#1][c]}}
803 % \end{macrocode}
804 % \end{macro}
805 %
806 % \begin{macro}{\@iframebox}
807 % The handling the optional arguments.
808 % \changes{v1.0i}{1994/06/01}
809 % {New version, so \cs{width} is correct in \cs{framebox}}
810 % \changes{v1.0j}{1994/10/18}
811 % {\cs{leavevmode} moved to \cs{@frameb@x}}
812 % \changes{v1.0s}{1995/04/27}
813 % {Move \cs{leavevmode} for graphics/1512}
814 % \changes{v1.4e}{2023/10/26}
815 % {Guard against unknown alignment gh/1072}
816 % In order to set the whole box, including the frame to the
817 % specified dimension, we first determine that dimension
818 % from the natural size of the text, |#3|.
819 % calculated width.
820 % \begin{macrocode}
821 %</2ekernel>
822 %<latexrelease>\IncludeInRelease{2023/11/01}%
823 %<latexrelease> {\@iframebox}{Unknown alignment warning}%
824 %<*2ekernel|latexrelease>
825 \long\def\@iframebox[#1][#2]#3{%
826 \leavevmode
827 \@begin@tempboxa\hbox{#3}%
828 \setlength\@tempdima{#1}%
829 \setbox\@tempboxa\hb@xt@\@tempdima
830 {\kern\fboxsep
831 \expandafter\ifx\csname bm@#2\endcsname\relax
832 \bm@c
833 \@latex@warning{Unexpected alignment #2}%
834 \else
835 \csname bm@#2\endcsname
836 \fi
837 \kern\fboxsep}%
838 \@frameb@x{\kern-\fboxrule}%
839 \@end@tempboxa}
840 %</2ekernel|latexrelease>
841 %<latexrelease>\EndIncludeInRelease
842 %<latexrelease>\IncludeInRelease{0000/00/00}%
843 %<latexrelease> {\@iframebox}{Unknown alignment warning}%
844 %<latexrelease>\long\def\@iframebox[#1][#2]#3{%
845 %<latexrelease> \leavevmode
846 %<latexrelease> \@begin@tempboxa\hbox{#3}%
847 %<latexrelease> \setlength\@tempdima{#1}%
848 %<latexrelease> \setbox\@tempboxa\hb@xt@\@tempdima
849 %<latexrelease> {\kern\fboxsep\csname bm@#2\endcsname\kern\fboxsep}%
850 %<latexrelease> \@frameb@x{\kern-\fboxrule}%
851 %<latexrelease> \@end@tempboxa}
852 %<latexrelease>\EndIncludeInRelease
853 %<*2ekernel>
854 % \end{macrocode}
855 % \end{macro}
856 %
857 % \begin{macro}{\@frameb@x}
858 % Common part of |\framebox| and |\fbox|. |#1| is a negative kern
859 % in the |\framebox| case so that the vertical rules do not add to the
860 % width of the box.
861 % \changes{v1.0i}{1994/06/01}
862 % {Macro added.}
863 % \changes{v1.0j}{1994/10/18}
864 % {\cs{leavevmode} added}
865 % \changes{v1.0s}{1995/04/27}
866 % {Move \cs{leavevmode} for graphics/1512}
867 % \begin{macrocode}
868 \def\@frameb@x#1{%
869 \@tempdima\fboxrule
870 \advance\@tempdima\fboxsep
871 \advance\@tempdima\dp\@tempboxa
872 \hbox{%
873 \lower\@tempdima\hbox{%
874 \vbox{%
875 \hrule\@height\fboxrule
876 \hbox{%
877 \vrule\@width\fboxrule
878 #1%
879 \vbox{%
880 \vskip\fboxsep
881 \box\@tempboxa
882 \vskip\fboxsep}%
883 #1%
884 \vrule\@width\fboxrule}%
885 \hrule\@height\fboxrule}%
886 }%
887 }%
888 }
889 % \end{macrocode}
890 % \end{macro}
891 %
892 % \begin{macro}{\@framepicbox}
893 % Picture mode version.
894 % \begin{macrocode}
895 \def\@framepicbox(#1,#2){%
896 \@ifnextchar[{\@iframepicbox(#1,#2)}{\@iframepicbox(#1,#2)[]}}
897 % \end{macrocode}
898 % \end{macro}
899 %
900 % \begin{macro}{\@iframepicbox}
901 % Picture mode version.
902 % \begin{macrocode}
903 \long\def\@iframepicbox(#1,#2)[#3]#4{%
904 \frame{\@imakepicbox(#1,#2)[#3]{#4}}}
905 % \end{macrocode}
906 % \end{macro}
907 %
908 % \begin{macro}{\parbox}
909 % \changes{v0.1a}{1993/12/03}
910 % {Redefined to support extra optional arguments}
911 % \changes{v0.1d}{1993/12/15}
912 % {Changed default from `c' to `s'}
913 % The main vertical-box command for \LaTeX.
914 % \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
915 % \begin{macrocode}
916 %</2ekernel>
917 %<latexrelease>\IncludeInRelease{2015/01/01}%
918 %<latexrelease> {\parbox}{Make \parbox robust}%
919 %<*2ekernel|latexrelease>
920 \DeclareRobustCommand\parbox{%
921 \@ifnextchar[%]
922 \@iparbox
923 {\@iiiparbox c\relax[s]}}%
924 %</2ekernel|latexrelease>
925 %<latexrelease>\EndIncludeInRelease
926 %<latexrelease>\IncludeInRelease{0000/00/00}%
927 %<latexrelease> {\parbox}{Make \parbox robust}%
928 %<latexrelease>\def\parbox{%
929 %<latexrelease> \@ifnextchar[%]
930 %<latexrelease> \@iparbox
931 %<latexrelease> {\@iiiparbox c\relax[s]}}%
932 %<latexrelease>\expandafter\let\csname parbox \endcsname\@undefined
933 %<latexrelease>\EndIncludeInRelease
934 %<*2ekernel>
935 % \end{macrocode}
936 % \end{macro}
937 %
938 % \begin{macro}{\@iparbox}
939 % \changes{v0.1d}{1993/12/15}
940 % {Changed default from `c' to `s'}
941 % Optional argument handling.
942 % \begin{macrocode}
943 \def\@iparbox[#1]{%
944 \@ifnextchar[%]
945 {\@iiparbox{#1}}%
946 {\@iiiparbox{#1}\relax[s]}}
947 % \end{macrocode}
948 % \end{macro}
949 %
950 % \begin{macro}{\@iiparbox}
951 % Optional argument handling.
952 % \begin{macrocode}
953 \def\@iiparbox#1[#2]{%
954 \@ifnextchar[%]
955 {\@iiiparbox{#1}{#2}}%
956 {\@iiiparbox{#1}{#2}[#1]}}
957 % \end{macrocode}
958 % \end{macro}
959 %
960 % \begin{macro}{\@iiiparbox}
961 % \begin{macro}{\@parboxto}
962 % \changes{v1.0j}{1994/10/18}
963 % {Macro added to remove misuse of \cs{@empty}}
964 % \changes{v0.1b}{1993/12/08}
965 % {\cs{endgraf} added due to extra group in \cs{@begin@tempboxa}}
966 % \changes{v1.0y}{1996/06/10}
967 % {(DPC) Changed \cs{endgraf} to \cs{@@par}}
968 % \changes{v1.1f}{1999/04/27}
969 % {(CAR) Changed \cs{@empty} to \cs{relax} as flag for natural
970 % width: pr/2975}
971 % \changes{v1.1g}{2006/05/18}
972 % {Ensure \cs{@parboxto} holds the value of \cs{@tempdimb} not the
973 % register itself (pr/3867)}
974 % \changes{v1.4e}{2023/10/26}
975 % {Guard against unknown alignment gh/1072}
976 % The internal version of |\parbox|.
977 % \begin{macrocode}
978 \let\@parboxto\@empty
979 % \end{macrocode}
980 % \begin{macrocode}
981 %</2ekernel>
982 %<latexrelease>\IncludeInRelease{2023/11/01}%
983 %<latexrelease> {\@iiiparbox}{Unknown alignment warning}%
984 %<*2ekernel|latexrelease>
985 \long\def\@iiiparbox#1#2[#3]#4#5{%
986 \leavevmode
987 \@pboxswfalse
988 \setlength\@tempdima{#4}%
989 \@begin@tempboxa\vbox{\hsize\@tempdima\@parboxrestore#5\@@par}%
990 \ifx\relax#2\else
991 \setlength\@tempdimb{#2}%
992 \edef\@parboxto{to\the\@tempdimb}%
993 \fi
994 \if#1b\vbox
995 \else\if #1t\vtop
996 \else\ifmmode\vcenter
997 \else\@pboxswtrue $\vcenter
998 \fi\fi\fi
999 \@parboxto{\let\hss\vss\let\unhbox\unvbox
1000 \expandafter\ifx\csname bm@#3\endcsname\relax
1001 \bm@c
1002 \@latex@warning{Unexpected alignment #3}%
1003 \else
1004 \csname bm@#3\endcsname
1005 \fi}%
1006 \if@pboxsw \m@th$\fi
1007 \@end@tempboxa}
1008 %</2ekernel|latexrelease>
1009 %<latexrelease>\EndIncludeInRelease
1010 %<latexrelease>\IncludeInRelease{0000/00/00}%
1011 %<latexrelease> {\@iiiparbox}{Unknown alignment warning}%
1012 %<latexrelease>\long\def\@iiiparbox#1#2[#3]#4#5{%
1013 %<latexrelease> \leavevmode
1014 %<latexrelease> \@pboxswfalse
1015 %<latexrelease> \setlength\@tempdima{#4}%
1016 %<latexrelease> \@begin@tempboxa\vbox{\hsize\@tempdima\@parboxrestore#5\@@par}%
1017 %<latexrelease> \ifx\relax#2\else
1018 %<latexrelease> \setlength\@tempdimb{#2}%
1019 %<latexrelease> \edef\@parboxto{to\the\@tempdimb}%
1020 %<latexrelease> \fi
1021 %<latexrelease> \if#1b\vbox
1022 %<latexrelease> \else\if #1t\vtop
1023 %<latexrelease> \else\ifmmode\vcenter
1024 %<latexrelease> \else\@pboxswtrue $\vcenter
1025 %<latexrelease> \fi\fi\fi
1026 %<latexrelease> \@parboxto{\let\hss\vss\let\unhbox\unvbox
1027 %<latexrelease> \csname bm@#3\endcsname}%
1028 %<latexrelease> \if@pboxsw \m@th$\fi
1029 %<latexrelease> \@end@tempboxa}
1030 %<latexrelease>\EndIncludeInRelease
1031 %<*2ekernel>
1032 % \end{macrocode}
1033 % \end{macro}
1034 % \end{macro}
1035 %
1036 % \changes{v1.0c}{1994/04/12}
1037 % {Remove \cs{@acci}, now defined in ltplain.dtx}
1038 % \changes{v1.0c}{1994/04/12}
1039 % {Remove \cs{@dischyph}, now defined in ltinit.dtx}
1040 %
1041 % \begin{macro}{\@arrayparboxrestore}
1042 % Restore various paragraph parameters.
1043 %
1044 % The rational for allowing two normally global flags to be set
1045 % locally here was stated originally by
1046 % Donald Arseneau and extended by Chris Rowley.
1047 % It is because these flags are only set globally to
1048 % true by section commands, and these should never appear within
1049 % boxes or, indeed, in any group; and they are only ever
1050 % set globally to false when they are definitely true.
1051 %
1052 % If anyone is unhappy with this argument then both flags should be
1053 % treated as in |\@setnobreak|; otherwise this command will be
1054 % redundant.
1055 % \changes{v1.1a}{1996/10/24}{Added local settings of flags: dangerous!!}
1056 % \begin{macrocode}
1057 %</2ekernel>
1058 %<latexrelease>\IncludeInRelease{2017-04-15}%
1059 %<latexrelease> {\normallineskiplimit}
1060 %<latexrelease> {reset \lineskiplimit}%
1061 %<*2ekernel|latexrelease>
1062 \def\@arrayparboxrestore{%
1063 \let\if@nobreak\iffalse
1064 \let\if@noskipsec\iffalse
1065 \let\par\@@par
1066 \let\-\@dischyph
1067 % \end{macrocode}
1068 % Redefined accents to allow changes in font encoding
1069 % \changes{v1.0h}{1994/05/13}
1070 % {New accent system, use \cs{let} not \cs{def}}
1071 % \begin{macrocode}
1072 \let\'\@acci\let\`\@accii\let\=\@acciii
1073 \parindent\z@ \parskip\z@skip
1074 \everypar{}%
1075 \linewidth\hsize
1076 \@totalleftmargin\z@
1077 \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
1078 \parfillskip\@flushglue
1079 \lineskip\normallineskip
1080 % \end{macrocode}
1081 % \changes{v1.3a}{2017/03/29}
1082 % {Reset \cs{lineskiplimit}}
1083 % \begin{macrocode}
1084 \lineskiplimit\normallineskiplimit
1085 % \end{macrocode}
1086 %
1087 % \begin{macrocode}
1088 \baselineskip\normalbaselineskip
1089 \sloppy}
1090 %</2ekernel|latexrelease>
1091 % \end{macrocode}
1092 %
1093 % \begin{macrocode}
1094 %<latexrelease>\EndIncludeInRelease
1095 %<latexrelease>\IncludeInRelease{0000-00-00}%
1096 %<latexrelease> {\normallineskiplimit}
1097 %<latexrelease> {reset \lineskiplimit}%
1098 %<latexrelease>\def\@arrayparboxrestore{%
1099 %<latexrelease> \let\if@nobreak\iffalse
1100 %<latexrelease> \let\if@noskipsec\iffalse
1101 %<latexrelease> \let\par\@@par
1102 %<latexrelease> \let\-\@dischyph
1103 %<latexrelease> \let\'\@acci\let\`\@accii\let\=\@acciii
1104 %<latexrelease> \parindent\z@ \parskip\z@skip
1105 %<latexrelease> \everypar{}%
1106 %<latexrelease> \linewidth\hsize
1107 %<latexrelease> \@totalleftmargin\z@
1108 %<latexrelease> \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
1109 %<latexrelease> \parfillskip\@flushglue \lineskip\normallineskip
1110 %<latexrelease> \baselineskip\normalbaselineskip
1111 %<latexrelease> \sloppy}
1112 %<latexrelease>\EndIncludeInRelease
1113 %<*2ekernel>
1114 % \end{macrocode}
1115 % \end{macro}
1116 %
1117 % \begin{macro}{\@parboxrestore}
1118 % Restore various paragraph parameters, and also |\\|.
1119 % \begin{macrocode}
1120 \def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr}
1121 % \end{macrocode}
1122 % \end{macro}
1123 %
1124 % \begin{macro}{\if@minipage}
1125 % Switch that is true at the start of a minipage.
1126 % \changes{v1.0z}{1996/07/26}{put \cs{global} into definition}
1127 % \begin{macrocode}
1128 \def\@minipagefalse{\global\let\if@minipage\iffalse}
1129 \def\@minipagetrue {\global\let\if@minipage\iftrue}
1130 \@minipagefalse
1131 % \end{macrocode}
1132 % \end{macro}
1133 %
1134 % \begin{macro}{\if@in@minipage@env}
1135 %
1136 % \changes{v1.4d}{2022/09/07}
1137 % {Check for nested minipages and warn (gh/168)}
1138 % \begin{macrocode}
1139 \newif\if@in@minipage@env
1140 % \end{macrocode}
1141 % \end{macro}
1142 %
1143 %
1144 % \begin{macro}{\minipage}
1145 % \changes{v0.1a}{1993/12/03}
1146 % {Redefined to support extra optional arguments}
1147 % \changes{v0.1d}{1993/12/15}
1148 % {extra space removed.}
1149 % \changes{v0.1d}{1993/12/15}
1150 % {Changed default from `c' to `s'}
1151 % Essentially an environment form of |\parbox|.
1152 % \begin{macrocode}
1153 \def\minipage{%
1154 \@ifnextchar[%]
1155 \@iminipage
1156 {\@iiiminipage c\relax[s]}}
1157 % \end{macrocode}
1158 % \end{macro}
1159 %
1160 % \begin{macro}{\@iminipage}
1161 % \changes{v0.1d}{1993/12/15}
1162 % {Changed default from `c' to `s'}
1163 % Optional argument handling.
1164 % \begin{macrocode}
1165 \def\@iminipage[#1]{%
1166 \@ifnextchar[%]
1167 {\@iiminipage{#1}}%
1168 {\@iiiminipage{#1}\relax[s]}}
1169 % \end{macrocode}
1170 % \end{macro}
1171 %
1172 % \begin{macro}{\@iiminipage}
1173 % Optional argument handling.
1174 % \begin{macrocode}
1175 \def\@iiminipage#1[#2]{%
1176 \@ifnextchar[%]
1177 {\@iiiminipage{#1}{#2}}%
1178 {\@iiiminipage{#1}{#2}[#1]}}
1179 % \end{macrocode}
1180 % \end{macro}
1181 %
1182 % \begin{macro}{\@iiiminipage}
1183 % \changes{v1.0e}{1994/04/21}
1184 % {Extra \cs{bgroup} for color}
1185 % \changes{v1.0f}{1994/05/11}
1186 % {Use new \cs{color@setgroup} concept.}
1187 % Internal form of |minipage|.
1188 % \changes{v1.1a}{1996/10/24}{Use it or lose it (@setminpage): Frank
1189 % will want to lose it}
1190 % \begin{macrocode}
1191 \def\@iiiminipage#1#2[#3]#4{%
1192 \leavevmode
1193 \@pboxswfalse
1194 \setlength\@tempdima{#4}%
1195 \def\@mpargs{{#1}{#2}[#3]{#4}}%
1196 \setbox\@tempboxa\vbox\bgroup
1197 \color@begingroup
1198 \hsize\@tempdima
1199 \textwidth\hsize \columnwidth\hsize
1200 % \end{macrocode}
1201 % We check for nested minipages inside the box so that there is
1202 % always a group resetting the switch even if the code does not use
1203 % \cs{begin} to start the minipage.
1204 % \changes{v1.4d}{2022/09/07}
1205 % {Check for nested minipages and warn (gh/168)}
1206 % \begin{macrocode}
1207 \if@in@minipage@env
1208 % \end{macrocode}
1209 % We only issue a warning if the outer minipage contained footnotes
1210 % because that is the problematical case.
1211 % \begin{macrocode}
1212 \ifvoid\@mpfootins\else
1213 \@latex@warning{Nested minipage:
1214 footnotes may be misplaced}%
1215 \fi
1216 \else
1217 \@in@minipage@envtrue
1218 \fi
1219 % \end{macrocode}
1220 %
1221 % \begin{macrocode}
1222 \@parboxrestore
1223 \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
1224 \let\@footnotetext\@mpfootnotetext
1225 \let\@listdepth\@mplistdepth \@mplistdepth\z@
1226 \@minipagerestore
1227 \@setminipage}
1228 % \end{macrocode}
1229 % \end{macro}
1230 %
1231 % \begin{macro}{\@minipagerestore}
1232 % Hook so that other styles can reset other commands in a minipage.
1233 % \begin{macrocode}
1234 \let\@minipagerestore=\relax
1235 % \end{macrocode}
1236 % \end{macro}
1237 %
1238 %
1239 % \begin{macro}{\endminipage}
1240 % \changes{LaTeX209}{1992/08/14}
1241 % {(RmS) replaced \cs{vskip}-\cs{lastskip} by \cs{unskip}
1242 % (proposed by FMi)}
1243 % \changes{v1.0e}{1994/04/21}
1244 % {Extra \cs{egroup} for color}
1245 % \changes{v1.0f}{1994/05/11}
1246 % {Use new \cs{color@setgroup} concept.}
1247 % \changes{v1.0n}{1994/11/05}
1248 % {Color resetting for footnotes moved to here: as for main
1249 % page.}
1250 % \begin{macrocode}
1251 \def\endminipage{%
1252 \par
1253 \unskip
1254 \ifvoid\@mpfootins\else
1255 \vskip\skip\@mpfootins
1256 \normalcolor
1257 \footnoterule
1258 \unvbox\@mpfootins
1259 \fi
1260 \@minipagefalse %% added 24 May 89
1261 \color@endgroup
1262 \egroup
1263 \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}}
1264 % \end{macrocode}
1265 % \end{macro}
1266 %
1267 % \begin{macro}{\@mplistdepth}
1268 % \begin{macro}{\@mpfootins}
1269 % Versions of |\@listdepth| and |\footins| local to minipage.
1270 % \begin{macrocode}
1271 \newcount\@mplistdepth
1272 \newinsert\@mpfootins
1273 % \end{macrocode}
1274 % \end{macro}
1275 % \end{macro}
1276 %
1277 % \begin{macro}{\@mpfootnotetext}
1278 % Minipage version of |\@footnotetext|.
1279 %
1280 % Final |\strut| added 27 Mar 89, on suggestion by Don Hosek
1281 % \changes{LaTeX2.09}{1991/09/29}{(RmS) added \cs{reset@font}}
1282 % \changes{LaTeX2.09}{1992/11/26}{(RmS) added protection for \cs{edef}}
1283 % \changes{v0.1a}{1994/03/07}{Extra group for color}
1284 % \changes{v1.0e}{1994/04/21}
1285 % {Extra \cs{endgraf} for color}
1286 % \changes{v1.0f}{1994/05/11}
1287 % {Use new \cs{color@setgroup} concept.}
1288 % \changes{v1.0f}{1994/05/11}
1289 % {Use new \cs{normalcolor} and \cs{@finalstrut}.}
1290 % \changes{v1.0m}{1994/11/04}
1291 % {Added \cs{protected@edef}. ASAJ.}
1292 % \changes{v1.0n}{1994/11/05}
1293 % {Color resetting for footnotes moved to endminipage: as for main
1294 % page.}
1295 % \changes{v1.0o}{1994/11/05}
1296 % {Color groups restored here.}
1297 % \changes{v1.4b}{2021/02/10}
1298 % {Explicitly run \cs{par} in support for paragraph tagging}
1299 % \changes{v1.4c}{2021/10/14}
1300 % {Explicitly set \cs{@currentcounter} (gh/687)}
1301 % \begin{macrocode}
1302 %</2ekernel>
1303 %<*2ekernel|latexrelease>
1304 %<latexrelease>\IncludeInRelease{2021/11/15}%
1305 %<latexrelease> {\@mpfootnotetext}{footnotetext tagging}%
1306 \long\def\@mpfootnotetext#1{%
1307 \global\setbox\@mpfootins\vbox{%
1308 \unvbox\@mpfootins
1309 \reset@font\footnotesize
1310 \hsize\columnwidth
1311 \@parboxrestore
1312 \def\@currentcounter{mpfootnote}%
1313 \protected@edef\@currentlabel
1314 {\csname p@mpfootnote\endcsname\@thefnmark}%
1315 \color@begingroup
1316 \@makefntext{%
1317 \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
1318 \par
1319 \color@endgroup}}
1320 %</2ekernel|latexrelease>
1321 %<latexrelease>\EndIncludeInRelease
1322 % \end{macrocode}
1323 % \begin{macrocode}
1324 %<latexrelease>\IncludeInRelease{2021/06/01}%
1325 %<latexrelease> {\@mpfootnotetext}{footnotetext tagging}%
1326 %<latexrelease>\long\def\@mpfootnotetext#1{%
1327 %<latexrelease> \global\setbox\@mpfootins\vbox{%
1328 %<latexrelease> \unvbox\@mpfootins
1329 %<latexrelease> \reset@font\footnotesize
1330 %<latexrelease> \hsize\columnwidth
1331 %<latexrelease> \@parboxrestore
1332 %<latexrelease> \protected@edef\@currentlabel
1333 %<latexrelease> {\csname p@mpfootnote\endcsname\@thefnmark}%
1334 %<latexrelease> \color@begingroup
1335 %<latexrelease> \@makefntext{%
1336 %<latexrelease> \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
1337 %<latexrelease> \par
1338 %<latexrelease> \color@endgroup}}
1339 %<latexrelease>\EndIncludeInRelease
1340 % \end{macrocode}
1341 %
1342 % \begin{macrocode}
1343 %<latexrelease>\IncludeInRelease{0000/00/00}%
1344 %<latexrelease> {\@mpfootnotetext}{footnotetext tagging}%
1345 %<latexrelease>
1346 %<latexrelease>\long\def\@mpfootnotetext#1{%
1347 %<latexrelease> \global\setbox\@mpfootins\vbox{%
1348 %<latexrelease> \unvbox\@mpfootins
1349 %<latexrelease> \reset@font\footnotesize
1350 %<latexrelease> \hsize\columnwidth
1351 %<latexrelease> \@parboxrestore
1352 %<latexrelease> \protected@edef\@currentlabel
1353 %<latexrelease> {\csname p@mpfootnote\endcsname\@thefnmark}%
1354 %<latexrelease> \color@begingroup
1355 %<latexrelease> \@makefntext{%
1356 %<latexrelease> \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
1357 %<latexrelease> \color@endgroup}}
1358 %<latexrelease>
1359 %<latexrelease>\EndIncludeInRelease
1360 %<*2ekernel>
1361 % \end{macrocode}
1362 % \end{macro}
1363 %
1364 % \begin{macrocode}
1365 \newif\if@pboxsw
1366 % \end{macrocode}
1367 %
1368 % \begin{macro}{\rule}
1369 % Draw a rule of the specified size.
1370 % \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
1371 % \begin{macrocode}
1372 %</2ekernel>
1373 %<latexrelease>\IncludeInRelease{2015/01/01}%
1374 %<latexrelease> {\rule}{Make \rule robust}%
1375 %<*2ekernel|latexrelease>
1376 \DeclareRobustCommand\rule{\@ifnextchar[\@rule{\@rule[\z@]}}%
1377 %</2ekernel|latexrelease>
1378 %<latexrelease>\EndIncludeInRelease
1379 %<latexrelease>\IncludeInRelease{0000/00/00}%
1380 %<latexrelease> {\rule}{Make \rule robust}%
1381 %<latexrelease>\def\rule{\@ifnextchar[\@rule{\@rule[\z@]}}%
1382 %<latexrelease>\expandafter\let\csname rule \endcsname\@undefined
1383 %<latexrelease>\EndIncludeInRelease
1384 %<*2ekernel>
1385 % \end{macrocode}
1386 % \end{macro}
1387 %
1388 % \begin{macro}{\@rule}
1389 % Internal form of |\rule|.
1390 % \changes{v1.1c}{1998/06/04}{Support calc-expressions}
1391 % \begin{macrocode}
1392 \def\@rule[#1]#2#3{%
1393 \leavevmode
1394 \hbox{%
1395 \setlength\@tempdima{#1}%
1396 \setlength\@tempdimb{#2}%
1397 \setlength\@tempdimc{#3}%
1398 \advance\@tempdimc\@tempdima
1399 \vrule\@width\@tempdimb\@height\@tempdimc\@depth-\@tempdima}}
1400 % \end{macrocode}
1401 % \end{macro}
1402 %
1403 % \begin{macro}{\@@underline}
1404 % Saved primitive |\underline|.
1405 % \begin{macrocode}
1406 \let\@@underline\underline
1407 % \end{macrocode}
1408 % \end{macro}
1409 %
1410 % \begin{macro}{\underline}
1411 % \LaTeX\ version works outside math.
1412 % \task{???}{why the second `relax in `underline ?}
1413 % \begin{macrocode}
1414 \DeclareRobustCommand\underline[1]{%
1415 \relax
1416 \ifmmode\@@underline{#1}%
1417 \else $\@@underline{\hbox{#1}}\m@th$\relax\fi}
1418 % \end{macrocode}
1419 % \end{macro}
1420 %
1421 % \begin{macro}{\raisebox}
1422 % \changes{v0.1a}{1993/12/03}
1423 % {redefined to support \cs{height}}
1424 % \changes{v1.0s}{1995/04/27}
1425 % {Move \cs{leavevmode} for graphics/1512}
1426 % Raise a box, and change its vertical dimensions.
1427 % \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
1428 % \begin{macrocode}
1429 %</2ekernel>
1430 %<latexrelease>\IncludeInRelease{2015/01/01}%
1431 %<latexrelease> {\raisebox}{Make \raisebox robust}%
1432 %<*2ekernel|latexrelease>
1433 \DeclareRobustCommand\raisebox[1]{%
1434 \leavevmode
1435 \@ifnextchar[{\@rsbox{#1}}{\@irsbox{#1}[]}}
1436 %</2ekernel|latexrelease>
1437 %<latexrelease>\EndIncludeInRelease
1438 %<latexrelease>\IncludeInRelease{0000/00/00}%
1439 %<latexrelease> {\raisebox}{Make \raisebox robust}%
1440 %<latexrelease>\def\raisebox#1{%
1441 %<latexrelease> \leavevmode
1442 %<latexrelease> \@ifnextchar[{\@rsbox{#1}}{\@irsbox{#1}[]}}
1443 %<latexrelease>\expandafter\let\csname raisebox \endcsname\@undefined
1444 %<latexrelease>\EndIncludeInRelease
1445 %<*2ekernel>
1446 % \end{macrocode}
1447 % \end{macro}
1448 %
1449 % \begin{macro}{\@rsbox}
1450 % Optional argument handling.
1451 % \begin{macrocode}
1452 \def\@rsbox#1[#2]{%
1453 \@ifnextchar[{\@iirsbox{#1}[#2]}{\@irsbox{#1}[#2]}}
1454 % \end{macrocode}
1455 % \end{macro}
1456 %
1457 % \begin{macro}{\@argrsbox}
1458 % \changes{v0.1a}{1993/12/03}
1459 % {macro removed}
1460 % ...
1461 % \end{macro}
1462 %
1463 % \begin{macro}{\@irsbox}
1464 % \changes{v0.1a}{1993/12/03}
1465 % {redefined to support \cs{height}}
1466 % \changes{v0.1b}{1993/12/08}
1467 % {fix typo}
1468 % \changes{v0.1c}{1993/12/09}
1469 % {fix another typo}
1470 % \changes{v0.1f}{1994/03/03}
1471 % {Replaced a missing \cs{else}}
1472 % \changes{v1.0s}{1995/04/27}
1473 % {Move \cs{leavevmode} for graphics/1512}
1474 % \changes{v1.0u}{1995/05/17}
1475 % {Removed surplus braces}
1476 % Internal version of |\raisebox| (less than two optional args).
1477 % \begin{macrocode}
1478 \long\def\@irsbox#1[#2]#3{%
1479 \@begin@tempboxa\hbox{#3}%
1480 \setlength\@tempdima{#1}%
1481 \ifx\\#2\\\else\setlength\@tempdimb{#2}\fi
1482 \setbox\@tempboxa\hbox{\raise\@tempdima\box\@tempboxa}%
1483 \ifx\\#2\\\else\ht\@tempboxa\@tempdimb\fi
1484 \box\@tempboxa
1485 \@end@tempboxa}
1486 % \end{macrocode}
1487 % \end{macro}
1488 %
1489 % \begin{macro}{\@iirsbox}
1490 % \changes{v0.1a}{1993/12/03}
1491 % {redefined to support \cs{height}}
1492 % \changes{v1.0s}{1995/04/27}
1493 % {Move \cs{leavevmode} for graphics/1512}
1494 % Internal version of |\raisebox| (two optional args).
1495 % \begin{macrocode}
1496 \long\def\@iirsbox#1[#2][#3]#4{%
1497 \@begin@tempboxa\hbox{#4}%
1498 \setlength\@tempdima{#1}%
1499 \setlength\@tempdimb{#2}%
1500 \setlength\dimen@{#3}%
1501 \setbox\@tempboxa\hbox{\raise\@tempdima\box\@tempboxa}%
1502 \ht\@tempboxa\@tempdimb
1503 \dp\@tempboxa\dimen@
1504 \box\@tempboxa
1505 \@end@tempboxa}
1506 % \end{macrocode}
1507 % \end{macro}
1508 %
1509 % \begin{macro}{\@finalstrut}
1510 % This macro adds a special strut the \emph{depth} of the box given as
1511 % |#1|, and height and width 0pt. It is used for ensuring that the
1512 % last line of a paragraph has the correct depth in `p' columns of
1513 % tables and in footnotes. In vertical mode nothing is done, as adding
1514 % the strut (as done in 2.09) would start a new paragraph. It would be
1515 % possible to inspect |\prevdepth| to check the depth of the
1516 % just-completed paragraph, but we do not do that here.
1517 % \changes{v1.0g}{1994/05/12}
1518 % {macro added}
1519 % Actually we do even less now, skip the vmode test as it broke tabular
1520 % `p' columns.
1521 % \changes{v1.0p}{1994/11/09}
1522 % {Revert \cs{finalstrut} to 2.09 equivalent (from ltpatch)}.
1523 % \changes{v1.0x}{1995/10/31}
1524 % {Add \cs{nobreak} in horiz mode to allow hyphenation.
1525 % internal/1931}
1526 %
1527 % The |\nobreak| was added (1995/10/31) to allow hyphenation of the
1528 % final word of the paragraph.
1529 %
1530 % In 2024 we changed the macro to account for vertical mode. In
1531 % that case we use a strut produced with \cs{hrule} to avoid
1532 % starting a new paragraph (resulting in spurious extra line) and
1533 % also account for the \cs{prevdepth} of the previous line.
1534 % \changes{v1.4f}{2024/04/18}
1535 % {Use a \cs{hrule} strut not a \cs{vrule} if already in
1536 % vertical mode (bug seen first with footmisc/14)}
1537 % \changes{v1.4g}{2024/06/10}
1538 % {Always use a \cs{vrule} strut after all, but back up by a baseline
1539 % if already in vertical mode. Otherwise empty table p-cells will
1540 % not get the correct width (bug seen first with colortbl)}
1541 % \begin{macrocode}
1542 %</2ekernel>
1543 %<*2ekernel|latexrelease>
1544 %<latexrelease>\IncludeInRelease{2024/06/01}%
1545 %<latexrelease> {\@finalstrut}{final strut correction}%
1546 \def\@finalstrut#1{%
1547 \unskip
1548 \ifhmode \nobreak
1549 \else
1550 % \end{macrocode}
1551 % If we are in vmode we now back up by a baseline.
1552 % \begin{macrocode}
1553 \vskip-\baselineskip
1554 \fi
1555 % \end{macrocode}
1556 % Finally we unconditionally use \cs{vrule}.
1557 % \begin{macrocode}
1558 \vrule\@width\z@\@height\z@\@depth\dp#1}
1559 %</2ekernel|latexrelease>
1560 %<latexrelease>\EndIncludeInRelease
1561 %<latexrelease>\IncludeInRelease{0000/00/00}%
1562 %<latexrelease> {\@finalstrut}{final strut correction}%
1563 %<latexrelease>\def\@finalstrut#1{%
1564 %<latexrelease> \unskip\ifhmode\nobreak\fi
1565 %<latexrelease> \vrule\@width\z@\@height\z@\@depth\dp#1}
1566 %<latexrelease>
1567 %<latexrelease>\EndIncludeInRelease
1568 %<*2ekernel>
1569 % \end{macrocode}
1570 % \end{macro}
1571 %
1572 %
1573 % \subsection{Some low-level constructs}
1574 %
1575 % The following commands are basically inherited from plain \TeX.
1576 %
1577 % \begin{macro}{\leftline}
1578 % \begin{macro}{\rightline}
1579 % \begin{macro}{\centerline}
1580 % \begin{macro}{\@@line}
1581 % These macros place text on a full line either centred or left or
1582 % right adjusted.
1583 % \begin{macrocode}
1584 \def\@@line{\hb@xt@\hsize}
1585 \DeclareRobustCommand\leftline[1]{\@@line{#1\hss}}
1586 \DeclareRobustCommand\rightline[1]{\@@line{\hss#1}}
1587 \DeclareRobustCommand\centerline[1]{\@@line{\hss#1\hss}}
1588 % \end{macrocode}
1589 % \end{macro}
1590 % \end{macro}
1591 % \end{macro}
1592 % \end{macro}
1593 %
1594 %
1595 % \begin{macro}{\rlap}
1596 % \begin{macro}{\llap}
1597 % \begin{macro}{\clap}
1598 % These macros place text to the left or right of the current
1599 % reference point without taking up space.
1600 % \begin{macrocode}
1601 \DeclareRobustCommand\rlap[1]{\hb@xt@\z@{#1\hss}}
1602 \DeclareRobustCommand\llap[1]{\hb@xt@\z@{\hss#1}}
1603 % \end{macrocode}
1604 % And here is the version that centers, it was initially introduced by
1605 % \texttt{mathtools}.
1606 % \changes{v1.3c}{2020/03/06}{Macro \cs{clap} added}
1607 % \begin{macrocode}
1608 \DeclareRobustCommand\clap[1]{\hb@xt@\z@{\hss#1\hss}}
1609 % \end{macrocode}
1610 % \end{macro}
1611 % \end{macro}
1612 % \end{macro}
1613 %
1614 % \begin{macrocode}
1615 %</2ekernel>
1616 % \end{macrocode}
1617 %
1618 % \Finale
1619 \endinput
1620 %
1621 % \Finale
1622 %