# Some assignments in the definition of \parbox

Why are these assignments necessary in the LaTeX's definition of \parbox?

\let\hss\vss\let\unhbox\unvbox


EDIT

I should have added that I wondered if the assignments will affect any in-parbox calls (i.e., calls made by the parbox material) to the original definitions of the macros \hss and \unhbox, since compatibility problems might arise.

-

If you look at the definition of \@iiiparbox, you have:

\long\def\@iiiparbox#1#2[#3]#4#5{%
\leavevmode
\@pboxswfalse
\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\ifmmode\vcenter
\else\@pboxswtrue $\vcenter \fi\fi\fi \@parboxto{\let\hss\vss\let\unhbox\unvbox \csname bm@#3\endcsname}% \if@pboxsw \m@th$\fi
\@end@tempboxa}


Argument #3 is actually position argument, so \csname bm@#3\endcsname would make \bm@c, \bm@l, \bm@r, \bm@b, \bm@t, and \bm@s. But these are defined as:

\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}


Obviously these are for horizontal mode so in \parbox, or minipage environment, you need to have vertical version of these so that explains the existence of \let\hss\vss\let\unhbox\unvbox in the definition of \@iiiparbox.

-
Very good explanation. I believe that the real reason was to save some memory, avoiding permanent distinct definitions for the (more frequent) horizontal case and the vertical case. When LaTeX2e was released, saving as much memory as possible was very important. – egreg Jul 7 '12 at 7:48