1

This is my first question here. I hope I can explain it clearly enough.

I'm creating a tabular with an uneven amount of content in its columns and I'd like for the columns containing fewer rows of material to be vertically centered against those with more.

A simple example (easily solvable with the multirow package) would look something like this:

    A    |    B    
___________________
         | Blah
 Hey sup | Blah    
         | Blah

But if I had two rows of content in column A, I would like for their general shape to still be vertically centered against column B, meaning that the individual rows of column A would not align with any counterpart in B, but would be floating somewhere between two.

Put another way, if every row is 20 vertical units high, I would like the two lines of text in column A (40 vertical units) to contain 10 units of padding above and below them for a more centered positioning against the three rows (60 units) of column B.

The solution can be manual and dirty. It doesn't have to automatically calculate differences between columns. The program I'm writing will take care of that. But all the better if there is a really elegant answer to this.

Thanks in advance.

**Edit:

This was a foolish question. If the items in the lesser row are stacked towards the top, like this:

    A    |    B    
___________________
 Hey sup | Blah
 Hey man | Blah    
         | Blah

then multirow will absolutely handle it as it should. My problems stemmed from improper formatting of column A. It works fine now:

multirows

Sorry that my first question here was such a dumb one!

2

You can try nested tables so that the column with less content can be entered as separate small tables with more than one row. Each separate table may contain three rows against one cell in column B. Using an m-type column (from the array package) will force table cells to be vertically centered.

\documentclass[12pt,a4paper]{article}
\usepackage{array,booktabs}
\begin{document}

\begin{tabular}{cm{.6\linewidth}} \toprule
A   &   B  \\ \midrule
\begin{tabular}{@{}c@{}}
First row \\ \midrule
Second row
\end{tabular}
&
Some content for column B which is longer than the content of two rows of column A ... Some content for column B which is longer than the content of two rows of column A ... Some content for column B which is longer than the content of two rows of column A ... \\ \midrule
\begin{tabular}{@{}c@{}}
First row \\ \midrule
Second row
\end{tabular}
&
Some content for column B which is longer than the content of two rows of column A ... Some content for column B which is longer than the content of two rows of column A ... Some content for column B which is longer than the content of two rows of column A ... \\ \bottomrule
\end{tabular}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.