# How to create table cells of multiple rows in LaTeX

You may have encountered the problem where you wanted to merge multiple cells in a table column. Especially in the table headers (the leftmost column), this is not unthinkable. In this post, a simple way to realize this is described. We will be using the multirow package to do this.

## Preamble

In the preamble, make sure the following to packages are called:

\usepackage{booktabs} \usepackage{multirow}

The booktabs package is needed to typeset good looking tables. I’ve written a post on the booktabs package earlier. The multirow package is needed to create cells spanning multiple rows in your LaTeX tables.

## Document

I’ve created a simple 3-column table to illustrate the method by using the multirow command that comes with the multirow package:

\begin{table} \centering% \begin{tabular}{lll} \toprule First & Second & Third \\ \midrule 1 & & \multirow{2}{80pt}{AB} \\ 2 & & \\ 3 & \multirow{-3}{*}{123} & C \\ \bottomrule \end{tabular} \end{table}

The multirow command is defined as follows:

\multirow{nrows}{width}{content}
• nrows: number of rows to be spanned.
• width: width of the content.
• content: the text that will be printed
• Note that this number may be positive or negative, as illustrated in the example. In the second column, -3 was used in the last rows. This means that the third row and the 2 previous rows are merged. In the rightmost column, nrows was set to 2 on row 1. This merges the first and second row.
The width may be set to either a length measure or an asterix (*). The latter needs to be used to set the contents’ natural width.