[Tex/LaTex] Making a table in Latex with both single and multicolumn table headers

formattingtables

I am very new to using Latex and only know the basics when it comes to creating tables. I need to create a table that has 5 columns and header made from 2 rows.

The first column in the header should be the same size as the rest of the first column.

The second and third rows of the header should share the 1st column header title, with two categories making up the second row of the header that lines up with the rest of the second and third columns.

I would then repeat the process above for the fourth and fifth columns.

I have provided a picture of what my table looks like in word for reference. Is this possible to do in LaTeX? In the attached picture, I have drawn red lines outlining where the different parts of the header and columns should be.

Thanks in advanceTable from word

Best Answer

You can use

  • \multicolumn{2}{c}{Text} to have a cell with content Text, aligned as c (you could also add vertical lines here), spanning 2 columns. This can be used for single columns, or some or all columns in a row.
  • \multirow{2}{*}{Text} to have a cell with content Text spanning 2 rows.

Note: Using multicolumn you just skip the merged cells, while for multirow you still type the merged cells but leave them empty.

\documentclass{article}
\usepackage{multirow}

\begin{document}
\begin{tabular}{ccccc}
    \hline
    \multirow{2}{*}{$AR$} & \multicolumn{2}{c}{$Re=110$} & \multicolumn{2}{c}{$Re=1400$} \\
    & 1\textsuperscript{st} Revolution & 3\textsuperscript{rd} Revolution & 1\textsuperscript{st} Revolution & 3\textsuperscript{rd} Revolution \\
    \hline
    3 & 2.44\% & 6.74\% & 3.05\% & 10.4\% \\
    5 & 1.52\% & 6.65\% & 3.88\% & 11.0\% \\
    7 & 1.18\% & 2.34\% & 5.80\% & 7.11\% \\
    \hline
\end{tabular}
\end{document}

enter image description here

This is not yet the most beautiful way of how to typeset this particular table, so keep on asking questions and looking for inspirations on this side! Consider for example using the booktabs package.