Tables: merging columns

To merge columns, use \multicolumn{no. of cols}{formatting}{text}:

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

\begin{document}

\section*{Tables: merging columns}

\begin{table}
  \centering
  \begin{tabular}{lll}
    \toprule
    Header: column 1 & \multicolumn{2}{c}{Header: columns 2--3}  \\
                     & Subheader: column 2 & Subheader: column 3 \\
    \midrule
    Row 1, column 1  & Row 1, column 2     & Row 1, column 3     \\
    Row 2, column 1  & Row 2, column 2     & Row 2, column 3     \\
    \bottomrule
  \end{tabular}
\end{table}

\end{document}

The formatting is of the type you’d use with a tabular environment and the number of columns is how many columns you want to merge.

The booktabs package was used to produce pretty horizontal lines.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.