Spanning columns in LaTeX tables

Posted: 27th November 2011 by Tim in LaTeX
Tags: , , , , , , ,

Tables are a fairly important part of LaTeX. Often you will want data to span multiple columns of the table, similar to colspan in HTML. In LaTeX it’s pretty easy too, using the

\multicolumn{<cols>}{<format>}{<cell_text>}

command, where <cols> is the number of columns to span and <format> is the cell format (l, c or r for left, right or center). If you want left/right borders on the cell, you can use | characters just like in the tabular specification.

So, for example:

\begin{tabular}{|l|l|l|}
\hline
first column & second column & third column \\
\hline
\multicolumn{3}{|c|}{Cell spanning three columns} \\
\hline
\end{tabular}

will create:

first column second column third column
Cell spanning three columns
  1. Barga Deori says:

    how to span the column “first column” into another 3 columns again…………same as for second and third column