# text alignment between tabular and multicolumn environments

I am currently trying to work on a latex table to report data on different categories and have countered text alignment issues. I have tried to use two multicolumn environments and combination of multrow and multicolumn with no success.

\begin{table}
\caption{demo}
\label{tbl:demo}
\begin{tabular}{ ccccc }
\hline
\multirow{2}{*}{name} &
\begin{tabular}{c}
Category1 \\
column1 \\
\end{tabular}
&
\multicolumn{2}{c}{Category2}\\ %\cline{3-4}
&& column1 &column2  \\
\hline
n1 & 1 &  7 & 5 \\
n2  &- & 6 & 4 \\
n3 & 2 & 9 & 3 \\
\hline
\end{tabular}
\end{table}


Any pointers on how I can fix the alignment of the headers?

Kenneth

• Welcome to TeX.SX! Use different rows. – TeXnician Oct 14 '17 at 9:20

Here's a version with booktabs and correct alignment.

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\caption{demo}
\label{tbl:demo}
\begin{tabular}{ ccccc }
\toprule
& Category1 & \multicolumn{2}{c}{Category 2}\\\cmidrule(lr){2-2}\cmidrule(lr){3-4}
name & column1 & column1 &column2 \\
\midrule
n1 & 1 &  7 & 5 \\
n2  &- & 6 & 4 \\
n3 & 2 & 9 & 3 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}