[Tex/LaTex] Top Vertical Alignment with Multirow

multirowtablesvertical alignment

How can I align the contents of a multirow cell top the top?

Here's an MWE:

\documentclass{article}
\usepackage{array,multirow,booktabs,fullpage}

\begin{document}\begin{center}
\begin{tabular}{c>{\bfseries}l>{\itshape}clc>{\bfseries}l>{\itshape}cl}
\toprule
\multirow{1}{*}{\LARGE\bfseries A} & foo  & n. & lorem ipsum dolor sit &
\multirow{1}{*}{\LARGE\bfseries B} & foo  & n. & consectetur adipiscing elit \\
& bar  & v. & Maecenas sed purus       & & bar  & v. & at ipsum placerat luctus \\
& baz  & p. & Nullam luctus id tellus  & & baz  & p. & Ut ac ultricies neque \\
& qux  & v. & Aenean consequat commodo & & qux  & v. & in sodales metus ultrices \\
& buux & n. & Phasellus tincidunt      & & quux & n. & vitae pulvinar nisi mollis \\
\bottomrule
\end{tabular}\end{center}\end{document}

enter image description here

As you can see, what I've done is use the multirow command, but only set a row span of 1. This more or less gets me what I want: "hanging" letters, but with a couple of costs. First, I get a lot of Overfull \vbox warnings. The second is that the tops of the large letters are not actually precisely aligned:

enter image description here

Best Answer

I just uploaded a new version of multirow to CTAN. It should be available in a few days. If you want it now, just send me an email (you can find a working email address in multirow.sty).

With the new version you can give a positioning parameter [t] to \multirow to give it a top alignment. However, this will align the baselines of the letters, not the top. To align the tops you have to give it a fixup argument, that is the difference of the heights of the A and the f. This can be done as follows:

\usepackage{calc}
\newlength{\shiftdown}
\setlength{\shiftdown}{\heightof{f}-\heightof{\LARGE\bfseries A}}

and then

\multirow[t]{5}{*}[\shiftdown]{\LARGE\bfseries A} & foo  & n. & lorem ipsum dolor sit &
\multirow[t]{5}{*}[\shiftdown]{\LARGE\bfseries B} & foo  & n. & consectetur adipiscing elit \\
Related Question