% -*- Mode: TeX -*- \ifx\thisfileis\anUndefinedMacro\input maybeload \fi \thisfileis{tabbingbox} % abort loading if already loaded \input redefine % from texlocal % TABBING BOXES (LaTex) % % The \begin{tabbingbox}...\end{tabbingbox} environment saves % a tabbing environment in a box. This is one way to make a % box out of a bunch of lines and have the width of the % box be equal to the width of the longest line. Naturally, % tabbing commands are also available in the box, but they aren't % used much. % % An optional position argument [t], [b], or [c] as for \parbox % may be supplied. The default is [t]. % % A second optional argument [boxnumber] causes the box to be % saved in the indicated box number, instead of being returned. % Sample use of this form: \begin{tabbingbox}[b][0]... % % As a special feature, a [boxnumber] may have the form % [G boxnumber] to indicate a global assignment. % \makeatletter \newbox\@tabbingboxbox \def\tabbingbox{\@ifnextchar[{\@argXtabbingbox}%] {\let\@tabboxnum\@tabbingboxbox\@tabbingbox[t]}} \def\@argXtabbingbox[#1]{\@ifnextchar [{\@argYtabbingbox[#1]}{\let\@tabboxnum\@tabbingboxbox \@tabbingbox[#1]}%] } \def\@argYtabbingbox[#1][#2]{\def\@tabboxnum{#2}\@tabbingbox[#1]} \def\@tabbingbox[#1]{\global\setbox\@tabbingboxbox \hbox\bgroup\begingroup\minipage[#1]{\z@}\begingroup\tabbing} % The weird stuff with \unvbox below patches up a [b]-positioned % box, which for some reason gets final glue of zero that causes % the vbox to have zero depth and get positioned funny. \def\endtabbingbox{\global\@minipagetrue\endtabbing\endgroup \endminipage \setbox\@tempboxa\lastbox \ifdim \dp\@tempboxa=\z@ \vbox{\unvbox\@tempboxa\unskip}\else\box\@tempboxa\fi \global\@minipagefalse\endgroup \egroup \ifx\@tabboxnum\@tabbingboxbox\box\@tabboxnum \else \xdef\@snarftabbingbox {\if G\expandafter\@car\@tabboxnum\@nil\relax \global\setbox\expandafter\@cdr\@tabboxnum\relax\@nil \else \setbox\@tabboxnum\fi\box\@tabbingboxbox }\aftergroup\@snarftabbingbox \fi} %\def\endtabbingbox{\global\@minipagetrue\endtabbing\endgroup % \endminipage\unskip\endgroup\egroup\global\@minipagefalse % \ifx\@tabboxnum\@tabbingboxbox\box\@tabboxnum % \else % \xdef\@snarftabbingbox % {\if G\expandafter\@car\@tabboxnum\@nil\relax % \global\setbox\expandafter\@cdr\@tabboxnum\relax\@nil % \else % \setbox\@tabboxnum\fi\box\@tabbingboxbox % }\aftergroup\@snarftabbingbox % \fi} \makeatother