[texhax] aligning array columns at bottom rather than top vertically

Johan Glimming glimming at kth.se
Sat Feb 26 16:58:27 CET 2005

Hello Steve,

Thanks for looking into this. Actually, I am using a special macro to
typeset rules (enclosed, due to B.C. Pierce) and for some reason I
cannot use this rule inside arrays.

If I could, then I could write \infrule[name]{\phantom{axiom}][fact]

Out of curiosity, can I not use \vfill to force the vertical space to
be inserted before the end of a column in multicols or array
environments, rather than adding phantom or custom vspace?

---

%%% Put a rule and its label on the same line if this can be done
%%% without overlapping them; otherwise, put the label on the next
%%% line.  Put a small amount of vertical space above and below.
\newcommand{\layoutruleverbose}[2]%
{\unvbox\voidb at x  % to make sure we're in vmode

\setbox \rulebox \hbox{$\displaystyle #2$}

\setbox \@labelbox \hbox{#1}
\ruledim \wd \rulebox
\labeldim \wd \@labelbox

%%% Will it all fit comfortably on one line?
\@tempdima \linewidth
\ifdim \@tempdima < \ruledim
\@tempdima \ruledim
\else
\divide \@tempdima by 2
\fi
\ifdim \@tempdima < \linewidth
% Yes, everything fits on a line
\@tempdima \linewidth
\hbox to \linewidth{%
\hbox to \@tempdima{%
\hfil
\box\rulebox
\hfil}%
\hfill
\hbox to 0pt{\hss\box\@labelbox}%
}%
\else
%
% Will it all fit _UN_comfortably on one line?
\@tempdima 0pt
\ifdim \@tempdima < \linewidth
% Yes, everything fits, but not centered
\hbox to \linewidth{%
\hfil
\box\rulebox
\hskip \labelminsep
\box\@labelbox}%
\else
%
% Better put the label on the next line
\@tempdima \linewidth
\hbox to \linewidth{%
\hbox to \@tempdima{%
\hfil
\box\rulebox
\hfil}
\hfil}%
\penalty10000
\hbox to \linewidth{%
\hfil
\box\@labelbox}%
\fi\fi