Graphics, Figures & Tablesmultirow | Spanning three Rows with two Rows

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
tafi
Posts: 42
Joined: Sat May 07, 2011 12:01 am

multirow | Spanning three Rows with two Rows

Post by tafi »

Hi,

let's say I have a table with three rows. In some columns I have one entry for each row. This is the easiest data to enter and set correctly.

In another column I have one entry to span all three rows. This requires the multirow package, but is otherwise easy.

However in yet another column I have two rows of data, which I need to span (or center vertically) over three rows.

How can I achieve this? Can one put tabular material inside a \multirow command?

Thanks in advance

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

multirow | Spanning three Rows with two Rows

Post by cgnieder »

tafi wrote:Can one put tabular material INSIDE a \multirow command?
Yes, one can! A (simplified) example from the multirow documentation:

Code: Select all

\documentclass{article}
\usepackage{multirow}
\newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}}

\begin{document}        

\begin{tabular}{ccc}
 1 & 2 & 3 \\\hline
 a & \multirow{3}{*}{text} & \multirow{3}{*}{\minitab[c]{A\\B}} \\
 b \\
 c
\end{tabular}

\end{document}
Regards
site moderator & package author
tafi
Posts: 42
Joined: Sat May 07, 2011 12:01 am

Re: multirow | Spanning three Rows with two Rows

Post by tafi »

Thanks for that, I'd read the multirow documentation but I hadn't noticed that one.

Cheers
Sylver
Posts: 3
Joined: Fri Jun 01, 2012 5:11 pm

Re: multirow | Spanning three Rows with two Rows

Post by Sylver »

Hello,

It does work well until we do not need a vertical rule on the right edge of the tabular. In my case, I do use one and there is thus a blank in the right limit, on the minipage part.

Any chance someone would also know how to fix that ?

Thanks a lot in advance
Sylver
Posts: 3
Joined: Fri Jun 01, 2012 5:11 pm

multirow | Spanning three Rows with two Rows

Post by Sylver »

Hello,

Thanks for this trick. I however have a further question. In my case, I do use a right border in my tab and this result in a blank in the part where there is the {minipage}. Any chance someone would know how to fix it ?

Thanks a lot.


Edit:
Sorry about that, I forgot to put the & between the blank rows...
Post Reply