% \iffalse meta-comment
%
% Copyright (C) 1993-2026
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
%
% \iffalse
%%% From File: ltboxes.dtx
%
%<*driver>
% \fi
\ProvidesFile{ltboxes.dtx}
             [2026-07-29 v1.4k LaTeX Kernel (Box Commands)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltboxes.dtx}
\title{\filename}
\date{\filedate}
\author{David Carlisle\and
  Leslie Lamport\and
  Frank Mittelbach\and
  Chris Rowley}
\begin{document}
 \MaintainedByLaTeXTeam{latex}
 \maketitle
 \DocInput{\filename}
\end{document}
%</driver>
% \fi
%
%
% \changes{v1.1e}{1998/08/17}{(RmS) Minor Documentation fixes.}
% \changes{v1.3b}{2019/08/27}{Various commands made robust}
%
%
%
% \section{\LaTeX\ Box commands}
%
%
% \DescribeMacro\makebox
% |\makebox[|\meta{wid}|][|\meta{pos}|]{|\meta{obj}|}|\\
% Puts \meta{obj} in an |\hbox| of width \meta{wid}, positioned by
% \meta{pos}.
%
% The possible \meta{pos} are:\\
% \begin{tabular}{ll}
% |s| stretched,\\
% |l| flushleft,\\
% |r| flushright,\\
% |c| (default) centered.
% \end{tabular}
%
% If \meta{wid} is missing, then \meta{pos} is also missing and
% \meta{obj} is put in an |\hbox| of its natural width.
%
%  |\makebox(|\meta{x}|,|\meta{y}|)[|\meta{pos}|]{|\meta{obj}|}|\\
%  Puts \meta{obj} in an |\hbox| of width $x * |\unitlength|$
%            and height $y * |\unitlength|$.
% \meta{pos} arguments are
%  |s|, |l|, |r| or |c| (default) for stretched, flushleft, flushright
%  or centered, and  |t| or |b|
%            for top, bottom -- or combinations like  |tr| or |rb|.
%            Default for horizontal and vertical are centered.
% Note that in this picture mode version of |\makebox| a [b] aligns on
% the \emph{bottom} of the text as documented. If you want to align on
% the \emph{baseline} use
%  |\makebox( , )[b]{\raisebox{0pt}[\height][0pt]{xyz}}|
%  or |\makebox( , )[b]{\smash{xyz}}|
%
% \DescribeMacro\mbox
%  |\mbox{|\meta{obj}|}| The same as |\makebox{|\meta{obj}|}|, but is
%  more efficient as no checking for optional arguments is done.
%
% \DescribeMacro\newsavebox
%  |\newsavebox{\cmd}| : If |\cmd| is undefined, then defines it
%           to be a \TeX\ box register.
%
% \DescribeMacro\savebox
%  |\savebox{\cmd}| ... : |\cmd| is defined to be a \TeX\ box register,
%            and the '...' are any |\makebox| arguments.  It is
%            like |\makebox|, except it doesn't produce text but
%            saves the value in |\box| |\cmd|.
%
% \DescribeMacro\sbox
% |\sbox{|\meta{cmd}|}{|\meta{obj}|}| is an efficient abbreviation for\\
% |\savebox{|\meta{cmd}|}{|\meta{obj}|}|.
%
% \DescribeEnv{lrbox}
%  |\begin{lrbox}{|\meta{cmd}|}|\meta{text}|\end{lrbox}| is equivalent
%  to\\
%  |\sbox{|\meta{cmd}|}{|\meta{text}|}|\\
%  except that any white space at the beginning and end of \meta{text}
%  is ignored.
%
% \DescribeMacro\framebox
%  |\framebox| ...  : like |\makebox|, except it puts a `frame' around
%            the box.  The frame is made of lines of thickness
%            |\fboxrule|, separated by space |\fboxsep| from the
%            text -- except for |\framebox(X,Y)| ... , where the
%            thickness of the lines is as for the picture environment,
%            and there is no separation added.
%
% \DescribeMacro\fbox
% |\fbox{|\meta{obj}|}| is an abbreviation for
% |\framebox{|\meta{obj}|}|.
%
% \DescribeMacro\parbox
%  |\parbox[|\meta{pos}|][|\meta{height}|][|\meta{inner-pos}|]{|^^A
%                    \meta{width}|}{|\meta{text}|}| :
% Makes a box with |\hsize| \meta{width}, positioned by \meta{pos} as
% follows:
%              c : |\vcenter| (placed in |$...$| if not in math mode)
%              b : |\vbox|
%              t : |\vtop|
%         default value is c.
%    Sets |\hsize| := \meta{width} and calls |\@parboxrestore|, which
%    does the following:
%         Restores the original definitions of:
%
%              \begin{tabular}{l}
%              |\par|\\
%              |\\|\\
%              |\-|\\
%              |\'|\\
%              | \`|\\
%              |\=|
%              \end{tabular}
%
%         Resets the following parameters:
%
%              \begin{tabular}{l@{\quad=\quad}ll}
%              |\parindent|        & 0pt \\
%              |\parskip|          & 0pt           & added 20 Jan 87\\
%              |\linewidth|        & |\hsize|\\
%              |\@totalleftmargin| & 0pt\\
%              |\leftskip|         & 0pt\\
%              |\rightskip|        & 0pt\\
%              |\@rightskip|       & 0pt\\
%              |\parfillskip|      & 0pt plus 1fil\\
%              |\lineskip|         & |\normallineskip|\\
%              |\baselineskip|     & |\normalbaselineskip|
%              \end{tabular}
%
%         Calls |\sloppy|
%
%  Note: |\@arrayparboxrestore| same as |\@parboxrestore|
%         but it doesn't restore |\\|.
%
% \DescribeEnv{minipage}
% |minipage|  :  Similar to |\parbox|, except it also
%        makes this look like a page by setting
%
%              |\textwidth| == |\columnwidth| == box width
%
%        changes footnotes by redefining:\\%
%              |\@mpfn|         == mpfootnote \\
%              |\thempfn|       == |\thempfootnote|\\
%              |\@footnotetext| == |\@mpfootnotetext|
%
%        resets the following list environment parameters:\\
%              |\@listdepth|    == |\@mplistdepth|\\
%        where  |\@mplistdepth| is initialized to zero,
%
%        and executes |\@minipagerestore| to allow the document
%        style to reset any other parameters it desires.
%        It sets |@minipage| true, and resets |\everypar| to set
%        it false.  This switch keeps |\addvspace| from putting space
%        at the top of a minipage.
%
%        Change added 24 May 89: |\minipage| sets |@minipage| globally;
%        |\endminipage| resets it false.
%
%
% \DescribeMacro\rule
% |\rule[|\meta{raised}|]{|\meta{width}|}{|\meta{height}|}| :
% Makes a $\meta{width}*\meta{height}$ rule, raised \meta{raised}.
%
% \DescribeMacro\underline
% |\underline{|\meta{text}|}| : Makes an underlined hbox with
% \meta{text} in it.
%
% \DescribeMacro\raisebox
% |\raisebox{|\meta{distance}|}[|\meta{height}|][|\meta{depth}^^A
%                 |]{|\meta{box}|}| :\\
% Raises \meta{box} up by \meta{distance} length (down if
% \meta{distance} negative).  Makes \TeX\ think that the new box extends
% \meta{height} above the line and \meta{depth} below, for a total
% vertical length of \meta{height}+\meta{depth}.  Default values of
% \meta{height} \& \meta{depth} = actual height and depth of box in new
% position.
%
% \MaybeStop{}
%
% \changes{v0.1e}{1994/03/02}{Remove need for drv file}
% \changes{v0.1e}{1994/03/02}{Add 2ekernel module}
% \changes{v1.0a}{1994/03/07}{Unify format with other Kernel files}
% \changes{v1.0f}{1994/05/11}
%     {Superfluous braces removed from several commands}
% \changes{v1.0j}{1994/10/18}
%         {stuff from ltpatch done}
% \changes{v1.0p}{1994/11/09}
%         {more color changes\ldots}
% \changes{v1.0q}{1994/11/17}
%         {\cs{@tempa} to \cs{reserved@a}}
% \changes{v1.0t}{1995/05/07}{Use \cs{hb@xt@}}
% \changes{v1.0w}{1995/10/16}{Clarify makebox description}
%    \begin{macrocode}
%<*2ekernel>
\message{boxes,}
%    \end{macrocode}
%
% \begin{macro}{\makebox}
% \changes{v0.1a}{1993/12/03}
%         {modified}
% |\makebox| User level command just looks for optional
% |[| or |(|. \iffalse)]\fi
% \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/01/01}%
%<latexrelease>                 {\makebox}{Make \makebox robust}%
%<*2ekernel|latexrelease>
\DeclareRobustCommand\makebox{%
  \leavevmode
  \@ifnextchar(%)
    \@makepicbox
    {\@ifnextchar[\@makebox\mbox}}%
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\makebox}{Make \makebox robust}%
%<latexrelease>\def\makebox{%
%<latexrelease>  \leavevmode
%<latexrelease>  \@ifnextchar(%)
%<latexrelease>    \@makepicbox
%<latexrelease>    {\@ifnextchar[\@makebox\mbox}}%
%<latexrelease>\expandafter\let\csname makebox \endcsname\@undefined
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\mbox}
% \changes{v0.1a}{1993/12/03}
%         {extra group}
% \changes{v1.0j}{1994/10/18}
%         {\cs{long} added}
% The basic horizontal box command for \LaTeX.
%    \begin{macrocode}
\DeclareRobustCommand\mbox[1]{\leavevmode\hbox{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@makebox}
% \changes{v0.1a}{1993/12/03}
%         {default changed from x to c}
% Look for a possible second optional argument (defaults to |c|).
%    \begin{macrocode}
\def\@makebox[#1]{%
  \@ifnextchar [{\@imakebox[#1]}{\@imakebox[#1][c]}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@begin@tempboxa}
% \changes{v0.1a}{1993/12/03}
%         {macro added}
% \changes{v0.1b}{1993/12/08}
%         {Extra braces for color support
%          (braces removed from other macros)}
% \changes{v1.0f}{1994/05/11}
%         {Use new \cs{color@setgroup} concept.}
% Helper macro for supporting |\height|, |\width| etc. Grab |#1| into
% |\@tempboxa| and measure it.
%    \begin{macrocode}
\long\def\@begin@tempboxa#1#2{%
   \begingroup
     \setbox\@tempboxa#1{\color@begingroup#2\color@endgroup}%
     \def\width{\wd\@tempboxa}%
     \def\height{\ht\@tempboxa}%
     \def\depth{\dp\@tempboxa}%
     \let\totalheight\@ovri
     \totalheight\height
     \advance\totalheight\depth}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@end@tempboxa}
% \changes{v0.1a}{1993/12/03}
%         {macro added}
% End the group started by |\@begin@tempboxa|, so that the scope of
% |\height| only includes the `length' argument to the user-command.
%    \begin{macrocode}
\let\@end@tempboxa\endgroup
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bm@c}
% \begin{macro}{\bm@l}
% \begin{macro}{\bm@r}
% \begin{macro}{\bm@s}
% \begin{macro}{\bm@t}
% \begin{macro}{\bm@b}
% \changes{v0.1a}{1993/12/03}
%         {macros added}
% Set up spacing.
%    \begin{macrocode}
\def\bm@c{\hss\unhbox\@tempboxa\hss}
\def\bm@l{\unhbox\@tempboxa\hss}\let\bm@t\bm@l
\def\bm@r{\hss\unhbox\@tempboxa}\let\bm@b\bm@r
\def\bm@s{\unhbox\@tempboxa}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@imakebox}
% \changes{v0.1a}{1993/12/03}
%         {macro modified}
% \changes{v1.4e}{2023/10/26}
%         {Guard against unknown alignment gh/1072}
% Internal form of |\makebox|.
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2023/11/01}%
%<latexrelease>                 {\@imakebox}{Unknown alignment warning}%
%<*2ekernel|latexrelease>
\long\def\@imakebox[#1][#2]#3{%
  \@begin@tempboxa\hbox{#3}%
    \setlength\@tempdima{#1}%       support calc
    \hb@xt@\@tempdima{%
     \expandafter\ifx\csname bm@#2\endcsname\relax
       \bm@c
       \@latex@warning{Unexpected alignment #2}%
     \else
       \csname bm@#2\endcsname
     \fi}%
  \@end@tempboxa}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@imakebox}{Unknown alignment warning}%
%<latexrelease>\long\def\@imakebox[#1][#2]#3{%
%<latexrelease>  \@begin@tempboxa\hbox{#3}%
%<latexrelease>    \setlength\@tempdima{#1}%       support calc
%<latexrelease>    \hb@xt@\@tempdima{\csname bm@#2\endcsname}%
%<latexrelease>  \@end@tempboxa}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@makepicbox}
% \changes{v0.1a}{1993/12/03}
%         {macro modified}
% Picture mode form of |\makebox|.
%    \begin{macrocode}
\def\@makepicbox(#1,#2){%
  \@ifnextchar[{\@imakepicbox(#1,#2)}{\@imakepicbox(#1,#2)[]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@imakepicbox}
% picture mode version
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease>                 {\@imakepicbox}{default units}%
\long\def\@imakepicbox(#1,#2)[#3]#4{%
  \@defaultunitsset\@tempdimc{#2}\unitlength
  \vbox to\@tempdimc
   {\let\mb@b\vss \let\mb@l\hss\let\mb@r\hss
    \let\mb@t\vss
    \@tfor\reserved@a :=#3\do{%
      \if s\reserved@a
        \let\mb@l\relax\let\mb@r\relax
      \else
        \expandafter\let\csname mb@\reserved@a\endcsname\relax
      \fi}%
    \mb@t
    \@defaultunitsset\@tempdimc{#1}\unitlength
    \hb@xt@\@tempdimc{\mb@l #4\mb@r}%
    \mb@b
%    \end{macrocode}
% This kern ensures that a |b| option aligns on the bottom of the
% text rather than the baseline. this is the documented behaviour in
% the \LaTeX\ Book. The kern is removed in compatibility mode.
%    \begin{macrocode}
    \kern\z@}}
%</2ekernel|latexrelease>
%    \end{macrocode}
%
%    \begin{macrocode}
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@imakepicbox}{default units}%
%<latexrelease>\long\def\@imakepicbox(#1,#2)[#3]#4{%
%<latexrelease>  \vbox to#2\unitlength
%<latexrelease>   {\let\mb@b\vss \let\mb@l\hss\let\mb@r\hss
%<latexrelease>    \let\mb@t\vss
%<latexrelease>    \@tfor\reserved@a :=#3\do{%
%<latexrelease>      \if s\reserved@a
%<latexrelease>        \let\mb@l\relax\let\mb@r\relax
%<latexrelease>      \else
%<latexrelease>        \expandafter\let\csname mb@\reserved@a\endcsname\relax
%<latexrelease>      \fi}%
%<latexrelease>    \mb@t
%<latexrelease>    \hb@xt@ #1\unitlength{\mb@l #4\mb@r}%
%<latexrelease>    \mb@b
%<latexrelease>    \kern\z@}}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\set@color}
% \changes{v0.1a}{1993/12/03}
%         {macro added}
% \changes{v0.1a}{1993/12/03}
%         {color support}
% This macro is initially a no-op, but the color package will redefine
% it to insert a |\special|.
%    \begin{macrocode}
\let\set@color\relax
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\color@begingroup}
% \changes{v1.0b}{1994/03/14}
%         {macro added for color support}
% \begin{macro}{\color@setgroup}
% \changes{v1.0f}{1994/05/11}
%         {macro added for color support}
% \begin{macro}{\normalcolor}
% \changes{v1.0g}{1994/05/12}
%         {macro added for color support}
% \begin{macro}{\color@hbox}
% \changes{v1.0n}{1994/11/05}
%         {macro added for color support}
% \begin{macro}{\color@vbox}
% \changes{v1.0r}{1994/11/18}
%         {macro added for color support}
% \begin{macro}{\color@endbox}
% \changes{v1.0n}{1994/11/05}
%         {macro added for color support}
% \changes{v1.4b}{2021/02/04}
%         {Always add the color groups (gh/488)}
% In the past these macros were initially no-ops, and the \pkg{color}
% package redefined
% redefine them to be |\begingroup|, |\endgroup|,
% |\begingroup\set@color|,\\ |\hbox\bgroup\color@begingroup|,
% |\color@endgroup\egroup|.
% and \meta{set to main document color} respectively.
%
% Nowadays we always set the group already in the kernel as this makes the
% coding simpler.
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2021/06/01}%
%<latexrelease>                 {\color@begingroup}{color group settings}%
\let\color@begingroup\begingroup
\def\color@setgroup{\color@begingroup}        % changed further in color package
\let\normalcolor\relax                        % remains untouched; only changed in a color package
\def\color@hbox{\hbox\bgroup\color@begingroup}
\def\color@vbox{\vbox\bgroup\color@begingroup}
\def\color@endbox{\color@endgroup\egroup}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\color@begingroup}{color group settings}%
%<latexrelease>
%<latexrelease>\let\color@begingroup\relax
%<latexrelease>\let\color@setgroup\relax
%<latexrelease>\let\normalcolor\relax
%<latexrelease>\let\color@hbox\relax
%<latexrelease>\let\color@vbox\relax
%<latexrelease>\let\color@endbox\relax
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}



% \begin{macro}{\color@endgroup}
%    This macro is separated out because it received an update in 2024,
%    so requires its own rollback.
% \changes{v1.0b}{1994/03/14}
%         {macro added for color support}
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2026/06/01}%
%<latexrelease>                 {\color@endgroup}{color group settings}%
%    \end{macrocode}
%    Beside \cs{endgraf} for handling vertical boxes we also reset
%    \cs{if@endpe} as we are leaving the context but only if this
%    isn't an \cs{hbox} we are closing.
% \changes{v1.4h}{2024/06/23}{Adjust for new \texttt{@endpe} handling}
% \changes{v1.4j}{2026/04/13}{Do not reset \texttt{@endpe} in
%    \cs{color@endgroup} when ending an \cs{hbox}}
%    \begin{macrocode}
\def\color@endgroup{\endgraf\ifvmode\@endpefalse\fi\endgroup}
%<latexrelease>
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%    
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{2024/11/01}%
%<latexrelease>                 {\color@endgroup}{color group settings}%
%<latexrelease>\def\color@endgroup{\endgraf\@endpefalse\endgroup}
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%
%    
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{2021/06/01}%
%<latexrelease>                 {\color@endgroup}{color group settings}%
%<latexrelease>\def\color@endgroup{\endgraf\endgroup}
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\color@endgroup}{color group settings}%
%<latexrelease>
%<latexrelease>\let\color@endgroup\relax
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}



%
% \begin{macro}{\newsavebox}
% \changes{v0.1a}{1993/12/03}
%         {Pass the whole of arg 1 to \cs{@ifdefinable}}
% Allocate a new `savebox'.
%    \begin{macrocode}
\def\newsavebox#1{\@ifdefinable{#1}{\newbox#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\savebox}
% Save |#1| in a box register.
% \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/01/01}%
%<latexrelease>                 {\savebox}{Make \savebox robust}%
%<*2ekernel|latexrelease>
\DeclareRobustCommand\savebox[1]{%
  \@ifnextchar(%)
    {\@savepicbox#1}{\@ifnextchar[{\@savebox#1}{\sbox#1}}}%
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\savebox}{Make \savebox robust}%
%<latexrelease>\def\savebox#1{%
%<latexrelease>  \@ifnextchar(%)
%<latexrelease>    {\@savepicbox#1}{\@ifnextchar[{\@savebox#1}{\sbox#1}}}%
%<latexrelease>\expandafter\let\csname savebox \endcsname\@undefined
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\sbox}
% \changes{v0.1a}{1993/12/03}
%         {extra group}
% \changes{v0.1a}{1993/12/03}
%         {color support}
% \changes{v1.0b}{1994/03/14}
%         {Use \cs{color@setgroup}}
% \changes{v1.0j}{1994/10/18}
%         {\cs{long} added}
% Save |#1| in a box register.
%    \begin{macrocode}
\DeclareRobustCommand\sbox[2]{\setbox#1\hbox{%
  \color@setgroup#2\color@endgroup}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@savebox}
% \changes{v0.1a}{1993/12/03}
%         {default c not x}
% Look for second optional argument.
%    \begin{macrocode}
\def\@savebox#1[#2]{%
  \@ifnextchar [{\@isavebox#1[#2]}{\@isavebox#1[#2][c]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@isavebox}
% \changes{v0.1a}{1993/12/03}
%         {extra group}
% \changes{v0.1a}{1993/12/03}
%         {color support}
% \changes{v1.0b}{1994/03/14}
%         {Use \cs{color@setgroup}}
% \changes{v1.0d}{1994/04/15}
%         {Added missing percent character.}
% \changes{v1.0v}{1995/07/20}
%         {Use \cs{sbox}}
%    \begin{macrocode}
\long\def\@isavebox#1[#2][#3]#4{%
  \sbox#1{\@imakebox[#2][#3]{#4}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@savepicbox}
% Picture mode version of |\savebox|.
%    \begin{macrocode}
\def\@savepicbox#1(#2,#3){%
  \@ifnextchar[%]
    {\@isavepicbox#1(#2,#3)}{\@isavepicbox#1(#2,#3)[]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@isavepicbox}
% \changes{v0.1a}{1993/12/03}
%         {extra group}
% \changes{v1.0b}{1994/03/14}
%         {Use \cs{color@setgroup}}
% \changes{v1.0l}{1994/10/25}
%         {missing percent (moved from ltpatch)}
% \changes{v1.0v}{1995/07/20}
%         {Use \cs{sbox}}
% Picture mode version of |\savebox|.
%    \begin{macrocode}
\long\def\@isavepicbox#1(#2,#3)[#4]#5{%
  \sbox#1{\@imakepicbox(#2,#3)[#4]{#5}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lrbox}
% \changes{v0.1a}{1993/12/03}
%         {macro added}
% \changes{v0.1a}{1993/12/03}
%         {color support}
% \changes{v0.1b}{1993/12/08}
%         {move \cs{@endpefalse} out of the inner group}
% \changes{v1.0b}{1994/03/14}
%         {Use \cs{color@setgroup}}
% |lrbox|: the new environment form of |\sbox|. Use |\aftergroup| tricks
% to enable a \emph{local} assignment to be made to the box, in a way
% that it still has an effect \emph{outside} the |lrbox| environment.
%    \begin{macrocode}
\def\lrbox#1{%
  \edef\reserved@a{%
    \endgroup
    \setbox#1\hbox{%
      \begingroup\aftergroup}%
        \def\noexpand\@currenvir{\@currenvir}%
        \def\noexpand\@currenvline{\on@line}}%
  \reserved@a
    \@endpefalse
    \color@setgroup
      \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endlrbox}
% \changes{v0.1a}{1993/12/03}
%         {macro added}
% End the |lrbox| environment.
%    \begin{macrocode}
\def\endlrbox{\unskip\color@endgroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\usebox}
% unchanged
%    \begin{macrocode}
\DeclareRobustCommand\usebox[1]{\leavevmode\copy #1\relax}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\frame}
%
% The following definition of |\frame| was written by Pavel Curtis
% (Extra space removed 14 Jan 88)
% RmS 92/08/24: Replaced occurrence of |\@halfwidth| by |\@wholewidth|
%    \begin{macrocode}
\DeclareRobustCommand\frame[1]{%
  \leavevmode
  \hbox{%
    \hskip-\@wholewidth
    \vbox{%
      \vskip-\@wholewidth
      \hrule \@height\@wholewidth
      \hbox{%
        \vrule\@width\@wholewidth
        #1%
        \vrule\@width\@wholewidth}%
      \hrule\@height\@wholewidth
      \vskip-\@wholewidth}%
    \hskip-\@wholewidth}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\fboxrule}
% \begin{macro}{\fboxsep}
% user level parameters,
%    \begin{macrocode}
\newdimen\fboxrule
\newdimen\fboxsep
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\fbox}
% Abbreviated framed box command.
% \changes{v0.1a}{1993/12/03}
%         {extra group}
% \changes{v1.0g}{1994/05/12}
%         {New definition, merged with \cs{framebox}}
% \changes{v1.0i}{1994/06/01}
%         {New version, using \cs{@frameb@x}}
% \changes{v1.0j}{1994/10/18}
%         {\cs{long} added}
% \changes{v1.0k}{1994/10/24}
%         {Inner braces added (to fix latex/1061)}
% \changes{v1.0s}{1995/04/27}
%         {Move \cs{leavevmode} for graphics/1512}
%    \begin{macrocode}
\DeclareRobustCommand\fbox[1]{%
  \leavevmode
  \setbox\@tempboxa\hbox{%
    \color@begingroup
      \kern\fboxsep{#1}\kern\fboxsep
    \color@endgroup}%
  \@frameb@x\relax}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\framebox}
% Framed version of |\makebox|.
% \changes{v1.0g}{1994/05/12}
%         {Merged \cs{fbox} and \cs{framebox}}
% \changes{v1.0i}{1994/06/01}
%         {New version, so \cs{width} is correct in \cs{framebox}}
% \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/01/01}%
%<latexrelease>                 {\framebox}{Make \framebox robust}%
%<*2ekernel|latexrelease>
\DeclareRobustCommand\framebox{%
  \@ifnextchar(%)
    \@framepicbox{\@ifnextchar[\@framebox\fbox}}%
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\framebox}{Make \framebox robust}%
%<latexrelease>\def\framebox{%
%<latexrelease>  \@ifnextchar(%)
%<latexrelease>    \@framepicbox{\@ifnextchar[\@framebox\fbox}}%
%<latexrelease>\expandafter\let\csname framebox \endcsname\@undefined
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@framebox}
% Deal with optional arguments.
%    \begin{macrocode}
\def\@framebox[#1]{%
  \@ifnextchar[%]
    {\@iframebox[#1]}%
    {\@iframebox[#1][c]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@iframebox}
% The handling the optional arguments.
% \changes{v1.0i}{1994/06/01}
%         {New version, so \cs{width} is correct in \cs{framebox}}
% \changes{v1.0j}{1994/10/18}
%         {\cs{leavevmode} moved to \cs{@frameb@x}}
% \changes{v1.0s}{1995/04/27}
%         {Move \cs{leavevmode} for graphics/1512}
% \changes{v1.4e}{2023/10/26}
%         {Guard against unknown alignment gh/1072}
%    In order to set the whole box, including the frame to the
%    specified dimension, we first determine that dimension
%    from the natural size of the text, |#3|.
%    calculated width.
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2023/11/01}%
%<latexrelease>                 {\@iframebox}{Unknown alignment warning}%
%<*2ekernel|latexrelease>
\long\def\@iframebox[#1][#2]#3{%
  \leavevmode
  \@begin@tempboxa\hbox{#3}%
    \setlength\@tempdima{#1}%
    \setbox\@tempboxa\hb@xt@\@tempdima
         {\kern\fboxsep
          \expandafter\ifx\csname bm@#2\endcsname\relax
            \bm@c
            \@latex@warning{Unexpected alignment #2}%
          \else
            \csname bm@#2\endcsname
          \fi
          \kern\fboxsep}%
    \@frameb@x{\kern-\fboxrule}%
  \@end@tempboxa}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@iframebox}{Unknown alignment warning}%
%<latexrelease>\long\def\@iframebox[#1][#2]#3{%
%<latexrelease>  \leavevmode
%<latexrelease>  \@begin@tempboxa\hbox{#3}%
%<latexrelease>    \setlength\@tempdima{#1}%
%<latexrelease>    \setbox\@tempboxa\hb@xt@\@tempdima
%<latexrelease>         {\kern\fboxsep\csname bm@#2\endcsname\kern\fboxsep}%
%<latexrelease>    \@frameb@x{\kern-\fboxrule}%
%<latexrelease>  \@end@tempboxa}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@frameb@x}
% Common part of |\framebox| and |\fbox|. |#1| is a negative kern
% in the |\framebox| case so that the vertical rules do not add to the
% width of the box.
% \changes{v1.0i}{1994/06/01}
%         {Macro added.}
% \changes{v1.0j}{1994/10/18}
%         {\cs{leavevmode} added}
% \changes{v1.0s}{1995/04/27}
%         {Move \cs{leavevmode} for graphics/1512}
%    \begin{macrocode}
\def\@frameb@x#1{%
  \@tempdima\fboxrule
  \advance\@tempdima\fboxsep
  \advance\@tempdima\dp\@tempboxa
  \hbox{%
    \lower\@tempdima\hbox{%
      \vbox{%
        \hrule\@height\fboxrule
        \hbox{%
          \vrule\@width\fboxrule
          #1%
          \vbox{%
            \vskip\fboxsep
            \box\@tempboxa
            \vskip\fboxsep}%
          #1%
          \vrule\@width\fboxrule}%
        \hrule\@height\fboxrule}%
                          }%
        }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@framepicbox}
% Picture mode version.
%    \begin{macrocode}
\def\@framepicbox(#1,#2){%
  \@ifnextchar[{\@iframepicbox(#1,#2)}{\@iframepicbox(#1,#2)[]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@iframepicbox}
% Picture mode version.
%    \begin{macrocode}
\long\def\@iframepicbox(#1,#2)[#3]#4{%
  \frame{\@imakepicbox(#1,#2)[#3]{#4}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\parbox}
% \changes{v0.1a}{1993/12/03}
%         {Redefined to support extra optional arguments}
% \changes{v0.1d}{1993/12/15}
%         {Changed default from `c' to `s'}
% The main vertical-box command for \LaTeX.
% \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/01/01}%
%<latexrelease>                 {\parbox}{Make \parbox robust}%
%<*2ekernel|latexrelease>
\DeclareRobustCommand\parbox{%
  \@ifnextchar[%]
    \@iparbox
    {\@iiiparbox c\relax[s]}}%
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\parbox}{Make \parbox robust}%
%<latexrelease>\def\parbox{%
%<latexrelease>  \@ifnextchar[%]
%<latexrelease>    \@iparbox
%<latexrelease>    {\@iiiparbox c\relax[s]}}%
%<latexrelease>\expandafter\let\csname parbox \endcsname\@undefined
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@iparbox}
% \changes{v0.1d}{1993/12/15}
%         {Changed default from `c' to `s'}
% Optional argument handling.
%    \begin{macrocode}
\def\@iparbox[#1]{%
  \@ifnextchar[%]
    {\@iiparbox{#1}}%
    {\@iiiparbox{#1}\relax[s]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@iiparbox}
% Optional argument handling.
%    \begin{macrocode}
\def\@iiparbox#1[#2]{%
  \@ifnextchar[%]
    {\@iiiparbox{#1}{#2}}%
    {\@iiiparbox{#1}{#2}[#1]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vcenter@text}
% \changes{v1.4i}{2026/02/24}{New macro}
% \begin{macro}{\vcenter@text@auxi}
% \changes{v1.4i}{2026/02/24}{New macro}
% \begin{macro}{\vcenter@text@auxii}
% \changes{v1.4i}{2026/02/24}{New macro}
% \begin{macro}{\vcenter@text@axis}
% \changes{v1.4i}{2026/02/24}{New macro}
%   We have this idea in the L3 layer, but for use in tabulars, we need close-to
%   primitive syntax: that means some \cs{afterassignment} and \cs{aftergroup}
%   fun (remember \cs{afterassignment} for boxes inserts immediately after the
%   start of the box). To keep the calculation here as close as possible to the
%   one used by \cs{vcenter}, we implement the algorithm from \texttt{tex.web}:
%   \begin{verbatim}
% delta:=height(v)+depth(v);
% height(v):=axis_height(cur_size)+half(delta);
% depth(v):=delta-height(v);
%   \end{verbatim}
%   where
%   \begin{verbatim}
% @p function half(@!x:integer):integer;
% begin if odd(x) then half:=(x+1) div 2
% else half:=x @!div 2;
% end;
%   \end{verbatim}
%   As the total height is needed a couple of times, this is worked out in
%   a scratch dimen, before doing everything else using expressions. This way
%   we get pretty much exactly the same as \texttt{tex.web}.
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2026/06/01}%
%<latexrelease>                 {\vcenter@text}{Use real text vcenter}%
%<*2ekernel|latexrelease>
\protected\def\vcenter@text{%
  \check@mathfonts
  \afterassignment\vcenter@text@auxi
  \setbox0\vbox}
\protected\def\vcenter@text@auxi{%
  \aftergroup\vcenter@text@auxii
}
\protected\def\vcenter@text@auxii{%
  \begingroup
    \dimen0\dimexpr\ht0+\dp0\relax
    \ht0\dimexpr\dimexpr\ifodd\dimen0 1sp + \fi\dimen0\relax/2
      +\vcenter@text@axis\relax
    \dp0\dimexpr\dimen0-\ht0\relax
    \box0 %
  \endgroup
}
\ifdefined\directlua
  \newcommand*\vcenter@text@axis{\Umathaxis\textstyle}
\else
  \newcommand*\vcenter@text@axis{\fontdimen22 \textfont2 }
\fi
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\vcenter@text}{Use real text vcenter}%
%<latexrelease>\let\vcenter@text\@undefined
%<latexrelease>\let\vcenter@text@auxi\@undefined
%<latexrelease>\let\vcenter@text@auxii\@undefined
%<latexrelease>\let\vcenter@text@axis\@undefined
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@iiiparbox}
% \begin{macro}{\@parboxto}
% \changes{v1.0j}{1994/10/18}
%         {Macro added to remove misuse of \cs{@empty}}
% \changes{v0.1b}{1993/12/08}
%    {\cs{endgraf} added due to extra group in \cs{@begin@tempboxa}}
% \changes{v1.0y}{1996/06/10}
%         {(DPC) Changed \cs{endgraf} to \cs{@@par}}
% \changes{v1.1f}{1999/04/27}
%         {(CAR) Changed \cs{@empty} to \cs{relax} as flag for natural
%          width: pr/2975}
% \changes{v1.1g}{2006/05/18}
%         {Ensure \cs{@parboxto} holds the value of \cs{@tempdimb} not the
%          register itself (pr/3867)}
% \changes{v1.4e}{2023/10/26}
%         {Guard against unknown alignment gh/1072}
% \changes{v1.4i}{2026/02/24}{Use text mode vertical centering}
% The internal version of |\parbox|.
%    \begin{macrocode}
\let\@parboxto\@empty
%    \end{macrocode}
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2026/06/01}%
%<latexrelease>                 {\@iiiparbox}{Use real text vcenter}%
%<*2ekernel|latexrelease>
\long\def\@iiiparbox#1#2[#3]#4#5{%
  \leavevmode
  \setlength\@tempdima{#4}%
  \@begin@tempboxa\vbox{\hsize\@tempdima\@parboxrestore#5\@@par}%
    \ifx\relax#2\else
      \setlength\@tempdimb{#2}%
      \edef\@parboxto{to\the\@tempdimb}%
    \fi
    \if#1b\vbox
    \else\if #1t\vtop
    \else\vcenter@text
    \fi\fi
    \@parboxto{\let\hss\vss\let\unhbox\unvbox
     \expandafter\ifx\csname bm@#3\endcsname\relax
       \bm@c
       \@latex@warning{Unexpected alignment #3}%
     \else
       \csname bm@#3\endcsname
     \fi}%
  \@end@tempboxa}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{2023/11/01}%
%<latexrelease>                 {\@iiiparbox}{Use real text vcenter}%
%<latexrelease>\long\def\@iiiparbox#1#2[#3]#4#5{%
%<latexrelease>  \leavevmode
%<latexrelease>  \@pboxswfalse
%<latexrelease>  \setlength\@tempdima{#4}%
%<latexrelease>  \@begin@tempboxa\vbox{\hsize\@tempdima\@parboxrestore#5\@@par}%
%<latexrelease>    \ifx\relax#2\else
%<latexrelease>      \setlength\@tempdimb{#2}%
%<latexrelease>      \edef\@parboxto{to\the\@tempdimb}%
%<latexrelease>    \fi
%<latexrelease>    \if#1b\vbox
%<latexrelease>    \else\if #1t\vtop
%<latexrelease>    \else\ifmmode\vcenter
%<latexrelease>    \else\@pboxswtrue $\vcenter
%<latexrelease>    \fi\fi\fi
%<latexrelease>    \@parboxto{\let\hss\vss\let\unhbox\unvbox
%<latexrelease>     \expandafter\ifx\csname bm@#3\endcsname\relax
%<latexrelease>       \bm@c
%<latexrelease>       \@latex@warning{Unexpected alignment #3}%
%<latexrelease>     \else
%<latexrelease>       \csname bm@#3\endcsname
%<latexrelease>     \fi}%
%<latexrelease>    \if@pboxsw \m@th$\fi
%<latexrelease>  \@end@tempboxa}
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@iiiparbox}{Use real text vcenter}%
%<latexrelease>\long\def\@iiiparbox#1#2[#3]#4#5{%
%<latexrelease>  \leavevmode
%<latexrelease>  \@pboxswfalse
%<latexrelease>  \setlength\@tempdima{#4}%
%<latexrelease>  \@begin@tempboxa\vbox{\hsize\@tempdima\@parboxrestore#5\@@par}%
%<latexrelease>    \ifx\relax#2\else
%<latexrelease>      \setlength\@tempdimb{#2}%
%<latexrelease>      \edef\@parboxto{to\the\@tempdimb}%
%<latexrelease>    \fi
%<latexrelease>    \if#1b\vbox
%<latexrelease>    \else\if #1t\vtop
%<latexrelease>    \else\ifmmode\vcenter
%<latexrelease>    \else\@pboxswtrue $\vcenter
%<latexrelease>    \fi\fi\fi
%<latexrelease>    \@parboxto{\let\hss\vss\let\unhbox\unvbox
%<latexrelease>       \csname bm@#3\endcsname}%
%<latexrelease>    \if@pboxsw \m@th$\fi
%<latexrelease>  \@end@tempboxa}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{v1.0c}{1994/04/12}
%         {Remove \cs{@acci}, now defined in ltplain.dtx}
% \changes{v1.0c}{1994/04/12}
%         {Remove \cs{@dischyph}, now defined in ltinit.dtx}
%
% \begin{macro}{\@arrayparboxrestore}
% Restore various paragraph parameters.
%
% The rational for allowing two normally global flags to be set
% locally here was stated originally by
% Donald Arseneau and extended by Chris Rowley.
% It is because these flags are only set globally to
% true by section commands, and these should never appear within
% boxes or, indeed, in any group; and they are only ever
% set globally to false when they are definitely true.
%
% If anyone is unhappy with this argument then both flags should be
% treated as in |\@setnobreak|; otherwise this command will be
% redundant.
% \changes{v1.1a}{1996/10/24}{Added local settings of flags: dangerous!!}
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2017-04-15}%
%<latexrelease>                 {\normallineskiplimit}
%<latexrelease>                 {reset \lineskiplimit}%
%<*2ekernel|latexrelease>
\def\@arrayparboxrestore{%
  \let\if@nobreak\iffalse
  \let\if@noskipsec\iffalse
  \let\par\@@par
  \let\-\@dischyph
%    \end{macrocode}
% Redefined accents to allow changes in font encoding
% \changes{v1.0h}{1994/05/13}
%     {New accent system, use \cs{let} not \cs{def}}
%    \begin{macrocode}
  \let\'\@acci\let\`\@accii\let\=\@acciii
  \parindent\z@ \parskip\z@skip
  \everypar{}%
  \linewidth\hsize
  \@totalleftmargin\z@
  \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
  \parfillskip\@flushglue
  \lineskip\normallineskip
%    \end{macrocode}
% \changes{v1.3a}{2017/03/29}
%         {Reset \cs{lineskiplimit}}
%    \begin{macrocode}
  \lineskiplimit\normallineskiplimit
%    \end{macrocode}
%
%    \begin{macrocode}
  \baselineskip\normalbaselineskip
  \sloppy}
%</2ekernel|latexrelease>
%    \end{macrocode}
%
%    \begin{macrocode}
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000-00-00}%
%<latexrelease>                 {\normallineskiplimit}
%<latexrelease>                 {reset \lineskiplimit}%
%<latexrelease>\def\@arrayparboxrestore{%
%<latexrelease>  \let\if@nobreak\iffalse
%<latexrelease>  \let\if@noskipsec\iffalse
%<latexrelease>  \let\par\@@par
%<latexrelease>  \let\-\@dischyph
%<latexrelease>  \let\'\@acci\let\`\@accii\let\=\@acciii
%<latexrelease>  \parindent\z@ \parskip\z@skip
%<latexrelease>  \everypar{}%
%<latexrelease>  \linewidth\hsize
%<latexrelease>  \@totalleftmargin\z@
%<latexrelease>  \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
%<latexrelease>  \parfillskip\@flushglue \lineskip\normallineskip
%<latexrelease>  \baselineskip\normalbaselineskip
%<latexrelease>  \sloppy}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@parboxrestore}
% Restore various paragraph parameters, and also |\\|.
%    \begin{macrocode}
\def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@minipage}
% Switch that is true at the start of a minipage.
% \changes{v1.0z}{1996/07/26}{put \cs{global} into definition}
%    \begin{macrocode}
\def\@minipagefalse{\global\let\if@minipage\iffalse}
\def\@minipagetrue {\global\let\if@minipage\iftrue}
\@minipagefalse
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\if@in@minipage@env}
%    
% \changes{v1.4d}{2022/09/07}
%         {Check for nested minipages and warn (gh/168)}
%    \begin{macrocode}
\newif\if@in@minipage@env
%    \end{macrocode}
%  \end{macro}
%
%
% \begin{macro}{\minipage}
% \changes{v0.1a}{1993/12/03}
%         {Redefined to support extra optional arguments}
% \changes{v0.1d}{1993/12/15}
%         {extra space removed.}
% \changes{v0.1d}{1993/12/15}
%         {Changed default from `c' to `s'}
% Essentially an environment form of |\parbox|.
%    \begin{macrocode}
\def\minipage{%
  \@ifnextchar[%]
    \@iminipage
    {\@iiiminipage c\relax[s]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@iminipage}
% \changes{v0.1d}{1993/12/15}
%         {Changed default from `c' to `s'}
% Optional argument handling.
%    \begin{macrocode}
\def\@iminipage[#1]{%
  \@ifnextchar[%]
    {\@iiminipage{#1}}%
    {\@iiiminipage{#1}\relax[s]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@iiminipage}
% Optional argument handling.
%    \begin{macrocode}
\def\@iiminipage#1[#2]{%
  \@ifnextchar[%]
    {\@iiiminipage{#1}{#2}}%
    {\@iiiminipage{#1}{#2}[#1]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@iiiminipage}
% \changes{v1.0e}{1994/04/21}
%     {Extra \cs{bgroup} for color}
% \changes{v1.0f}{1994/05/11}
%         {Use new \cs{color@setgroup} concept.}
% Internal form of |minipage|.
% \changes{v1.1a}{1996/10/24}{Use it or lose it (@setminpage): Frank
%                             will want to lose it}
%    \begin{macrocode}
\def\@iiiminipage#1#2[#3]#4{%
  \leavevmode
  \@pboxswfalse
  \setlength\@tempdima{#4}%
  \def\@mpargs{{#1}{#2}[#3]{#4}}%
  \setbox\@tempboxa\vbox\bgroup
    \color@begingroup
      \hsize\@tempdima
      \textwidth\hsize \columnwidth\hsize
%    \end{macrocode}
%    We check for nested minipages inside the box so that there is
%    always a group resetting the switch even if the code does not use
%    \cs{begin} to start the minipage.
% \changes{v1.4d}{2022/09/07}
%         {Check for nested minipages and warn (gh/168)}
%    \begin{macrocode}
      \if@in@minipage@env
%    \end{macrocode}
%    We only issue a warning if the outer minipage contained footnotes
%    because that is the problematical case.
%    \begin{macrocode}
        \ifvoid\@mpfootins\else
          \@latex@warning{Nested minipage:
            footnotes may be misplaced}%
        \fi
      \else
        \@in@minipage@envtrue
      \fi
%    \end{macrocode}
%
%    \begin{macrocode}
      \@parboxrestore
      \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
      \let\@footnotetext\@mpfootnotetext
      \let\@listdepth\@mplistdepth \@mplistdepth\z@
      \@minipagerestore
      \@setminipage}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@minipagerestore}
% Hook so that other styles can reset other commands in a minipage.
%    \begin{macrocode}
 \let\@minipagerestore=\relax
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\endminipage}
% \changes{LaTeX209}{1992/08/14}
%     {(RmS) replaced \cs{vskip}-\cs{lastskip} by \cs{unskip}
%       (proposed by FMi)}
% \changes{v1.0e}{1994/04/21}
%     {Extra \cs{egroup} for color}
% \changes{v1.0f}{1994/05/11}
%         {Use new \cs{color@setgroup} concept.}
% \changes{v1.0n}{1994/11/05}
%     {Color resetting for footnotes moved to here: as for main
%     page.}
%    \begin{macrocode}
\def\endminipage{%
    \par
    \unskip
    \ifvoid\@mpfootins\else
      \vskip\skip\@mpfootins
      \normalcolor
      \footnoterule
      \unvbox\@mpfootins
    \fi
    \@minipagefalse   %% added 24 May 89
  \color@endgroup
  \egroup
  \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@mplistdepth}
% \begin{macro}{\@mpfootins}
% Versions of |\@listdepth| and |\footins| local to minipage.
%    \begin{macrocode}
\newcount\@mplistdepth
\newinsert\@mpfootins
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@mpfootnotetext}
% Minipage version of |\@footnotetext|.
%
% Final |\strut| added 27 Mar 89, on suggestion by Don Hosek
% \changes{LaTeX2.09}{1991/09/29}{(RmS) added \cs{reset@font}}
% \changes{LaTeX2.09}{1992/11/26}{(RmS) added protection for \cs{edef}}
% \changes{v0.1a}{1994/03/07}{Extra group for color}
% \changes{v1.0e}{1994/04/21}
%     {Extra \cs{endgraf} for color}
% \changes{v1.0f}{1994/05/11}
%         {Use new \cs{color@setgroup} concept.}
% \changes{v1.0f}{1994/05/11}
%         {Use new \cs{normalcolor} and \cs{@finalstrut}.}
% \changes{v1.0m}{1994/11/04}
%         {Added \cs{protected@edef}. ASAJ.}
% \changes{v1.0n}{1994/11/05}
%     {Color resetting for footnotes moved to endminipage: as for main
%     page.}
% \changes{v1.0o}{1994/11/05}
%     {Color groups restored here.}
% \changes{v1.4b}{2021/02/10}
%         {Explicitly run \cs{par} in support for paragraph tagging}
% \changes{v1.4c}{2021/10/14}
%         {Explicitly set \cs{@currentcounter} (gh/687)}
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2021/11/15}%
%<latexrelease>                 {\@mpfootnotetext}{footnotetext tagging}%
\long\def\@mpfootnotetext#1{%
  \global\setbox\@mpfootins\vbox{%
    \unvbox\@mpfootins
    \reset@font\footnotesize
    \hsize\columnwidth
    \@parboxrestore
    \def\@currentcounter{mpfootnote}%
    \protected@edef\@currentlabel
         {\csname p@mpfootnote\endcsname\@thefnmark}%
    \color@begingroup
      \@makefntext{%
        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
    \par
    \color@endgroup}}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{2021/06/01}%
%<latexrelease>                 {\@mpfootnotetext}{footnotetext tagging}%
%<latexrelease>\long\def\@mpfootnotetext#1{%
%<latexrelease>  \global\setbox\@mpfootins\vbox{%
%<latexrelease>    \unvbox\@mpfootins
%<latexrelease>    \reset@font\footnotesize
%<latexrelease>    \hsize\columnwidth
%<latexrelease>    \@parboxrestore
%<latexrelease>    \protected@edef\@currentlabel
%<latexrelease>         {\csname p@mpfootnote\endcsname\@thefnmark}%
%<latexrelease>    \color@begingroup
%<latexrelease>      \@makefntext{%
%<latexrelease>        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
%<latexrelease>    \par
%<latexrelease>    \color@endgroup}}
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@mpfootnotetext}{footnotetext tagging}%
%<latexrelease>
%<latexrelease>\long\def\@mpfootnotetext#1{%
%<latexrelease>  \global\setbox\@mpfootins\vbox{%
%<latexrelease>    \unvbox\@mpfootins
%<latexrelease>    \reset@font\footnotesize
%<latexrelease>    \hsize\columnwidth
%<latexrelease>    \@parboxrestore
%<latexrelease>    \protected@edef\@currentlabel
%<latexrelease>         {\csname p@mpfootnote\endcsname\@thefnmark}%
%<latexrelease>    \color@begingroup
%<latexrelease>      \@makefntext{%
%<latexrelease>        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
%<latexrelease>    \color@endgroup}}
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\newif\if@pboxsw
%    \end{macrocode}
%
% \begin{macro}{\rule}
% Draw a rule of the specified size.
% \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/01/01}%
%<latexrelease>                 {\rule}{Make \rule robust}%
%<*2ekernel|latexrelease>
\DeclareRobustCommand\rule{\@ifnextchar[\@rule{\@rule[\z@]}}%
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\rule}{Make \rule robust}%
%<latexrelease>\def\rule{\@ifnextchar[\@rule{\@rule[\z@]}}%
%<latexrelease>\expandafter\let\csname rule \endcsname\@undefined
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@rule}
% Internal form of |\rule|.
% \changes{v1.1c}{1998/06/04}{Support calc-expressions}
%    \begin{macrocode}
 \def\@rule[#1]#2#3{%
   \leavevmode
   \hbox{%
     \setlength\@tempdima{#1}%
     \setlength\@tempdimb{#2}%
     \setlength\@tempdimc{#3}%
     \advance\@tempdimc\@tempdima
     \vrule\@width\@tempdimb\@height\@tempdimc\@depth-\@tempdima}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@underline}
% Saved primitive |\underline|.
%    \begin{macrocode}
\let\@@underline\underline
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\underline}
% \changes{v1.4k}{2026-07-29}{Avoid fake math in \cs{underline}}
% \begin{macro}{\underline@text}
% \changes{v1.4k}{2026-07-29}{New macro}
% \begin{macro}{\underline@text@vgap}
% \changes{v1.4k}{2026-07-29}{New macro}
% \begin{macro}{\underline@text@thickness}
% \changes{v1.4k}{2026-07-29}{New macro}
% \begin{macro}{\underline@text@kern}
% \changes{v1.4k}{2026-07-29}{New macro}
%   As with other areas where we have removed math mode usage from text mode
%   material, we get as close as possible to primitive behaviors. As in other
%   places, we have to do a low-level box size change rather than add a kern
%   inside the box for the vgap. To preserve glue setting, we need to add an
%   additional box level compared to the \TeX{} primitive: using \cs{unhcopy}
%   fails if the content contains any glue components.
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2026-11-01}%
%<latexrelease>                 {\underline}{Avoid 'fake math'}%
%<*2ekernel|latexrelease>
\DeclareRobustCommand\underline[1]{%
  \relax
  \ifmmode
    \expandafter\@@underline
  \else
    \expandafter\underline@text
  \fi
    {#1}%
}
\protected\def\underline@text#1{%
  \leavevmode
  \check@mathfonts
  \begingroup
    \setbox0=\hbox{#1}%
    \setbox0=\vtop{%
      \hsize\wd0 %
      \copy0 %
      \kern\dimexpr\underline@text@vgap\relax
      \hrule height\dimexpr\underline@text@thickness\relax
       depth 0pt\relax
    }%
    \dp0\dimexpr\dp0+\underline@text@kern\relax
    \box0 %
  \endgroup
}
\ifdefined\directlua
  \newcommand*\underline@text@vgap{\Umathunderbarvgap\textstyle}
  \newcommand*\underline@text@thickness{\Umathunderbarrule\textstyle}
  \newcommand*\underline@text@kern{\Umathunderbarkern\textstyle}
\else
  \newcommand*\underline@text@vgap{3\fontdimen8\textfont3 }
  \newcommand*\underline@text@thickness{\fontdimen8\textfont3 }
  \newcommand*\underline@text@kern{\fontdimen8\textfont3 }
\fi
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\underline}{Avoid 'fake math'}%
%<latexrelease>\DeclareRobustCommand\underline[1]{%
%<latexrelease>  \relax
%<latexrelease>  \ifmmode\@@underline{#1}%
%<latexrelease>  \else $\@@underline{\hbox{#1}}\m@th$\relax\fi}
%<latexrelease>\let\underline@text\@undefined
%<latexrelease>\let\underline@text@vgap\@undefined
%<latexrelease>\let\underline@text@thickness\@undefined
%<latexrelease>\let\underline@text@kern\@undefined
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\raisebox}
% \changes{v0.1a}{1993/12/03}
%         {redefined to support \cs{height}}
% \changes{v1.0s}{1995/04/27}
%         {Move \cs{leavevmode} for graphics/1512}
% Raise a box, and change its vertical dimensions.
% \changes{v1.1h}{2015/01/08}{Make Robust (latexrelease)}
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/01/01}%
%<latexrelease>                 {\raisebox}{Make \raisebox robust}%
%<*2ekernel|latexrelease>
\DeclareRobustCommand\raisebox[1]{%
  \leavevmode
  \@ifnextchar[{\@rsbox{#1}}{\@irsbox{#1}[]}}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\raisebox}{Make \raisebox robust}%
%<latexrelease>\def\raisebox#1{%
%<latexrelease>  \leavevmode
%<latexrelease>  \@ifnextchar[{\@rsbox{#1}}{\@irsbox{#1}[]}}
%<latexrelease>\expandafter\let\csname raisebox \endcsname\@undefined
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@rsbox}
% Optional argument handling.
%    \begin{macrocode}
\def\@rsbox#1[#2]{%
  \@ifnextchar[{\@iirsbox{#1}[#2]}{\@irsbox{#1}[#2]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@argrsbox}
% \changes{v0.1a}{1993/12/03}
%         {macro removed}
% ...
% \end{macro}
%
% \begin{macro}{\@irsbox}
% \changes{v0.1a}{1993/12/03}
%         {redefined to support \cs{height}}
% \changes{v0.1b}{1993/12/08}
%         {fix typo}
% \changes{v0.1c}{1993/12/09}
%         {fix another typo}
% \changes{v0.1f}{1994/03/03}
%         {Replaced a missing \cs{else}}
% \changes{v1.0s}{1995/04/27}
%         {Move \cs{leavevmode} for graphics/1512}
% \changes{v1.0u}{1995/05/17}
%         {Removed surplus braces}
% Internal version of |\raisebox| (less than two optional args).
%    \begin{macrocode}
\long\def\@irsbox#1[#2]#3{%
  \@begin@tempboxa\hbox{#3}%
    \setlength\@tempdima{#1}%
    \ifx\\#2\\\else\setlength\@tempdimb{#2}\fi
    \setbox\@tempboxa\hbox{\raise\@tempdima\box\@tempboxa}%
    \ifx\\#2\\\else\ht\@tempboxa\@tempdimb\fi
    \box\@tempboxa
  \@end@tempboxa}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@iirsbox}
% \changes{v0.1a}{1993/12/03}
%         {redefined to support \cs{height}}
% \changes{v1.0s}{1995/04/27}
%         {Move \cs{leavevmode} for graphics/1512}
% Internal version of |\raisebox| (two optional args).
%    \begin{macrocode}
\long\def\@iirsbox#1[#2][#3]#4{%
  \@begin@tempboxa\hbox{#4}%
    \setlength\@tempdima{#1}%
    \setlength\@tempdimb{#2}%
    \setlength\dimen@{#3}%
    \setbox\@tempboxa\hbox{\raise\@tempdima\box\@tempboxa}%
    \ht\@tempboxa\@tempdimb
    \dp\@tempboxa\dimen@
    \box\@tempboxa
  \@end@tempboxa}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\@finalstrut}
% This macro adds a special strut the \emph{depth} of the box given as
% |#1|, and height and width 0pt. It is used for ensuring that the
% last line of a paragraph has the correct depth in `p' columns of
% tables and in footnotes. In vertical mode nothing is done, as adding
% the strut (as done in 2.09) would start a new paragraph. It would be
% possible to inspect |\prevdepth| to check the depth of the
% just-completed paragraph, but we do not do that here.
% \changes{v1.0g}{1994/05/12}
%         {macro added}
% Actually we do even less now, skip the vmode test as it broke tabular
% `p' columns.
% \changes{v1.0p}{1994/11/09}
%         {Revert \cs{finalstrut} to 2.09 equivalent (from ltpatch)}.
% \changes{v1.0x}{1995/10/31}
%         {Add \cs{nobreak} in horiz mode to allow hyphenation.
%                   internal/1931}
%
% The |\nobreak| was added (1995/10/31) to allow hyphenation of the
% final word of the paragraph.
%
%    In 2024 we changed the macro to account for vertical mode. In
%    that case we use a strut produced with \cs{hrule} to avoid
%    starting a new paragraph (resulting in spurious extra line) and
%    also account for the \cs{prevdepth} of the previous line.
% \changes{v1.4f}{2024/04/18}
%         {Use a \cs{hrule} strut not a \cs{vrule} if already in
%          vertical mode (bug seen first with footmisc/14)}
% \changes{v1.4g}{2024/06/10}
%         {Always use a \cs{vrule} strut after all, but back up by a baseline
%          if already in vertical mode. Otherwise empty table p-cells will
%          not get the correct width (bug seen first with colortbl)}
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2024/06/01}%
%<latexrelease>                 {\@finalstrut}{final strut correction}%
\def\@finalstrut#1{%
  \unskip
  \ifhmode \nobreak
  \else
%    \end{macrocode}
%    If we are in vmode we now back up by a baseline.
%    \begin{macrocode}
    \vskip-\baselineskip
  \fi
%    \end{macrocode}
%    Finally we unconditionally use \cs{vrule}.
%    \begin{macrocode}
  \vrule\@width\z@\@height\z@\@depth\dp#1}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@finalstrut}{final strut correction}%
%<latexrelease>\def\@finalstrut#1{%
%<latexrelease>  \unskip\ifhmode\nobreak\fi
%<latexrelease>  \vrule\@width\z@\@height\z@\@depth\dp#1}
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%  \end{macro}
%
%
% \subsection{Some low-level constructs}
%
% The following commands are basically inherited from plain \TeX.
%
%  \begin{macro}{\leftline}
%  \begin{macro}{\rightline}
%  \begin{macro}{\centerline}
%  \begin{macro}{\@@line}
%    These macros place text on a full line either centered or left or
%    right adjusted.
%    \begin{macrocode}
\def\@@line{\hb@xt@\hsize}
\DeclareRobustCommand\leftline[1]{\@@line{#1\hss}}
\DeclareRobustCommand\rightline[1]{\@@line{\hss#1}}
\DeclareRobustCommand\centerline[1]{\@@line{\hss#1\hss}}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%
%  \begin{macro}{\rlap}
%  \begin{macro}{\llap}
%  \begin{macro}{\clap}
%    These macros place text to the left or right of the current
%    reference point without taking up space.
%    \begin{macrocode}
\DeclareRobustCommand\rlap[1]{\hb@xt@\z@{#1\hss}}
\DeclareRobustCommand\llap[1]{\hb@xt@\z@{\hss#1}}
%    \end{macrocode}
%    And here is the version that centers, it was initially introduced by
%    \texttt{mathtools}.
% \changes{v1.3c}{2020/03/06}{Macro \cs{clap} added}
%    \begin{macrocode}
\DeclareRobustCommand\clap[1]{\hb@xt@\z@{\hss#1\hss}}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%    \begin{macrocode}
%</2ekernel>
%    \end{macrocode}
%
% \Finale
\endinput
%
% \Finale
%
