% \iffalse meta-comment
%
% Copyright 1994 the LaTeX3 project and the individual authors.
% All rights reserved. For further copyright information see the file
% legal.txt, and any other copyright indicated in this file.
% 
% This file is part of the LaTeX2e system.
% ----------------------------------------
% 
%  This system is distributed in the hope that it will be useful,
%  but WITHOUT ANY WARRANTY; without even the implied warranty of
%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% 
% 
% IMPORTANT NOTICE:
% 
% For error reports in case of UNCHANGED versions see bugs.txt.
% 
% Please do not request updates from us directly.  Distribution is
% done through Mail-Servers and TeX organizations.
% 
% You are not allowed to change this file.
% 
% You are allowed to distribute this file under the condition that
% it is distributed together with all files mentioned in manifest.txt.
% 
% If you receive only some of these files from someone, complain!
% 
% You are NOT ALLOWED to distribute this file alone.  You are NOT
% ALLOWED to take money for the distribution or use of either this
% file or a changed version, except for a nominal charge for copying
% etc.
% \fi
%
% \iffalse
%%% File: ltboxes
%
%<*driver>
% \fi
\ProvidesFile{ltboxes.dtx}
             [1994/06/01 v1.0i 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}
\maketitle
 \DocInput{\filename}
\end{document}
%</driver>
% \fi
%
% \CheckSum{713}
%
% \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) centred.
% \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 centred, and  |t| or |b|
%            for top, bottom -- or combinations like  |tr| or |rb|.
%            Default for horizontal and vertical are centered.
%
% \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. 
%
% \StopEventually{}
%
% \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}
%    \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 |(|.
%    \begin{macrocode}
\def\makebox{%
  \leavevmode
  \@ifnextchar(%)
    \@makepicbox
    {\@ifnextchar[\@makebox\mbox}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\mbox}
% \changes{v0.1a}{1993/12/03}
%         {extra group}
% The basic horizontal box command for \LaTeX.
%    \begin{macrocode}
\def\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}
% Internal form of |\makebox|.
%    \begin{macrocode}
\long\def\@imakebox[#1][#2]#3{%
  \@begin@tempboxa\hbox{#3}%
    \setlength\@tempdima{#1}%       support calc
    \hbox to\@tempdima{\csname bm@#2\endcsname}%
  \@end@tempboxa}  
%    \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}
\long\def\@imakepicbox(#1,#2)[#3]#4{%
  \vbox to#2\unitlength
   {\let\mb@b\vss \let\mb@l\hss\let\mb@r\hss
    \let\mb@t\vss 
    \@tfor\@tempa :=#3\do{%
      \if s\@tempa
        \let\mb@l\relax\let\mb@r\relax
      \else
        \expandafter\let\csname mb@\@tempa\endcsname\relax
      \fi}%
    \mb@t
    \hbox to #1\unitlength{\mb@l #4\mb@r}%
    \mb@b
    \kern\z@}}
%    \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 initialy a no-op, but the colour 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 colour support}
% \begin{macro}{\color@endgroup}
% \changes{v1.0b}{1994/03/14}
%         {macro added for colour support}
% \begin{macro}{\color@setgroup}
% \changes{v1.0f}{1994/05/11}
%         {macro added for colour support}
% \begin{macro}{\color@setgroup}
% \changes{v1.0g}{1994/05/12}
%         {macro added for colour support}
% These macros are initialy a no-op, but the colour package will
% redefine them to be |\begingroup|, |\endgroup|,
% |\begingroup\set@color|
% and \meta{set to main document colour} respectively.
%    \begin{macrocode}
\let\color@begingroup\relax
\let\color@endgroup\relax
\let\color@setgroup\relax
\let\normalcolor\relax
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\newsavebox}
% \changes{v0.1a}{1993/12/03}
%         {Pass the whole of arg 1 to \cmd{\@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.
%    \begin{macrocode}
\def\savebox#1{%
  \@ifnextchar(%)
    {\@savepicbox#1}{\@ifnextchar[{\@savebox#1}{\sbox#1}}}
%    \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 \cmd{\color@setgroup}}
% Save |#1| in a box register.
%    \begin{macrocode}
\def\sbox#1#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 \cmd{\color@setgroup}}
% \changes{v1.0d}{1994/04/15}
%         {Added missing precent character.}
%    \begin{macrocode}
\long\def\@isavebox#1[#2][#3]#4{%
  \setbox#1\hbox{%
    \color@setgroup
      \@imakebox[#2][#3]{#4}%
    \color@endgroup}}
%    \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 \cmd{\color@setgroup}}
% Picture mode version of |\savebox|.
%    \begin{macrocode}
\long\def\@isavepicbox#1(#2,#3)[#4]#5{%
  \setbox#1\hbox{%
    \color@setgroup
      \@imakepicbox(#2,#3)[#4]{#5}
    \color@endgroup}}
%    \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 \cmd{\@endpefalse} out of the inner group}
% \changes{v1.0b}{1994/03/14}
%         {Use \cmd{\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\@tempa{%
    \endgroup
    \setbox#1\hbox{%
      \begingroup\aftergroup}%
        \def\noexpand\@currenvir{\@currenvir}%
        \def\noexpand\@currenvline{\on@line}}%
  \@tempa
    \@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}
\def\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 occurence of |\@halfwidth| by |\@wholewidth|
%    \begin{macrocode}
\long\def\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, useing \cs{@frameb@x}}
%    \begin{macrocode}
\def\fbox#1{%
  \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}}
%    \begin{macrocode}
\def\framebox{%
  \@ifnextchar(%)
    \@framepicbox{\@ifnextchar[\@framebox\fbox}}
%    \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}}
%    \begin{macrocode}
\long\def\@iframebox[#1][#2]#3{%
  \leavevmode
%    \end{macrocode}
%    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}
  \@begin@tempboxa\hbox{#3}%
    \setlength\@tempdima{#1}%
    \setbox\@tempboxa\hbox to\@tempdima
         {\kern\fboxsep\csname bm@#2\endcsname\kern\fboxsep}%
    \@frameb@x{\kern-\fboxrule}%
  \@end@tempboxa}
%    \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.}
%    \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.
%    \begin{macrocode}
\def\parbox{%
  \@ifnextchar[%]
    \@iparbox
    {\@iiiparbox c\@empty[s]}}
%    \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}\@empty[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}{\@iiiparbox}
% \changes{v0.1b}{1993/12/08}
%    {\cmd{\endgraf} added due to extra group in \cmd{\@begin@tempboxa}}
% The internal version of |\parbox|.
%    \begin{macrocode}
\long\def\@iiiparbox#1#2[#3]#4#5{%
  \leavevmode 
  \@pboxswfalse
  \setlength\@tempdima{#4}%
  \@begin@tempboxa\vbox{\hsize\@tempdima\@parboxrestore#5\endgraf}%
    \ifx\@empty#2\else
      \setlength\@tempdimb{#2}%
      \def\@empty{to\@tempdimb}%
    \fi
    \if#1b\vbox
    \else\if #1t\vtop
    \else\ifmmode\vcenter
    \else\@pboxswtrue $\vcenter
    \fi\fi\fi
    \@empty{\let\hss\vss\let\unhbox\unvbox
       \csname bm@#3\endcsname}%
    \if@pboxsw \m@th$\fi
  \@end@tempboxa}
%    \end{macrocode}
% \end{macro}
%
% \changes{v1.0c}{1994/04/12}
%         {Remove \cmd{\@acci}, now defined in ltplain.dtx}
% \changes{v1.0c}{1994/04/12}
%         {Remove \cmd{\@dischyph}, now defined in ltinit.dtx}
%
% \begin{macro}{\@arrayparboxrestore}
% Restore various paragraph parameters.
%    \begin{macrocode}
\def\@arrayparboxrestore{%
  \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
  \baselineskip\normalbaselineskip
  \sloppy}
%    \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.
%    \begin{macrocode}
\newif\if@minipage \@minipagefalse
%    \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\@empty[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}\@empty[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 \cmd{\bgroup} for colour}
% \changes{v1.0f}{1994/05/11}
%         {Use new \cs{color@setgroup} concept.}
% Internal form of |minipage|.
%    \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
      \@parboxrestore
      \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
      \let\@footnotetext\@mpfootnotetext
      \let\@listdepth\@mplistdepth \@mplistdepth\z@
      \@minipagerestore\global\@minipagetrue %% \global added 24 May 89
      \everypar{\global\@minipagefalse\everypar{}}}
%    \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 \cmd\vskip-\cmd\lastskip by \cmd{\unskip}
%       (proposed by FMi)}
% \changes{v1.0e}{1994/04/21}
%     {Extra \cmd{\egroup} for colour}
% \changes{v1.0f}{1994/05/11}
%         {Use new \cs{color@setgroup} concept.}
%    \begin{macrocode}
\def\endminipage{%
    \par
    \unskip
    \ifvoid\@mpfootins\else
      \vskip\skip\@mpfootins
      \footnoterule
      \unvbox\@mpfootins
    \fi
    \global\@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 \cmd{\reset@font}}
% \changes{LaTeX2.09}{1992/11/26}{(RmS) added protection for \cmd\edef}
% \changes{v0.1a}{1994/03/07}{Extra group for colour}
% \changes{v1.0e}{1994/04/21}
%     {Extra \cmd{\endgraf} for colour}
% \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}.}
%    \begin{macrocode}
\long\def\@mpfootnotetext#1{%
  \global\setbox\@mpfootins\vbox{%
    \unvbox\@mpfootins
    \reset@font\footnotesize
    \hsize\columnwidth 
    \@parboxrestore
    \let\@tempa\protect\def\protect{\noexpand\protect\noexpand}%
    \edef\@currentlabel{\csname p@mpfootnote\endcsname\@thefnmark}%
    \let\protect\@tempa
    \color@begingroup
      \@makefntext{%
        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
    \color@endgroup}}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\newif\if@pboxsw
%    \end{macrocode}
%
% \begin{macro}{\rule}
% Draw a rule of the specified size.
%    \begin{macrocode}
\def\rule{\@ifnextchar[\@rule{\@rule[\z@]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@rule}
% internal form of |\rule|.
%    \begin{macrocode}
\def\@rule[#1]#2#3{%
  \@tempdima#3\advance\@tempdima #1%
  \leavevmode
  \hbox{\vrule\@width#2\@height\@tempdima\@depth-#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@underline}
% Saved primitive |\underline|.
%    \begin{macrocode}
\let\@@underline\underline
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\underline}
% \LaTeX\ version works outside math. 
% \task{???}{why the second `relax in `underline ?}
%    \begin{macrocode}
\def\underline#1{%
  \relax
  \ifmmode\@@underline{#1}%
  \else $\@@underline{\hbox{#1}}\m@th$\relax\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\raisebox}
% \changes{v0.1a}{1993/12/03}
%         {redefined to support \cmd\height}
% Raise a box, and change its vertical dimensions.
%    \begin{macrocode}
\def\raisebox#1{\@ifnextchar[{\@rsbox{#1}}{\@irsbox{#1}[]}}
%    \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 \cmd\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 \cmd\else}
% 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}%
    \leavevmode
    \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 \cmd\height}
% 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}%
    \leavevmode
    \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}
%    \begin{macrocode}
\def\@finalstrut#1{%
  \ifhmode
    \unskip\vrule\@width\z@\@height\z@\@depth\dp#1%
  \fi}
%    \end{macrocode}
%  \end{macro}
%
%    \begin{macrocode}
%</2ekernel>
%    \end{macrocode}
%
% \Finale
\endinput
%
% \Finale
%
