Multirow in use

The article describes how you create table cells that spans columns or rows in LaTeX, the LaTeX equivalent of colspan and rowspan in HTML.

Multirow

To be able to do this you need a package called multirow. The commands you use to create spanning cells are \multirow and \multicolumn.

\multirow usage

This command accepts three arguments: The number of rows the cell should span, the width of the cell itself and the content of the cell. You give the arguments like this: \multirow{number of rows}{width}{content}.

You don't have to set a specific width for the cell, but can let LaTeX determine a good size by passing an asterix (*) as the width argument.

PS: When you use \multirow you have to make sure that you don't fill the cells in the next rows you're spanning with content.

\multicolumn usage

Like \multirow, \multicolumn takes three arguments, but they're not quite the same. The arguments it takes are: Number of columns to span, placement of the content within the cell and the content of the cell. Use it like this: \multicolumn{number of columns}{placement}{content}.

Listing #1

\begin{tabular}{|l|l|r|}
  \hline
  \multicolumn{3}{|c|}{Cell spanning three columns} \\
  \hline
  \multirow{2}{*}{Cell spanning two rows}  & Hmm  & Ehm \\
      & eheh & asdasd \\
  \hline
\end{tabular}