I have two problems with a table as highlighted in red in the figure below.
- First, on the left, the multirow cell containing the text "Number" is not aligned at the center of the cell. I believe this happens because I have used a tabular inside the cell containing the "Very long category name distributed on two rows"; I did this because I need this text to be on two rows and I do not know another way to do that.
- The cell containing "Category" is obtained using multirow but as you can see on the right, there is no vertical bar. I have no idea why this happens.
Anyone knows how I can fix this? Here is my code with a MWE:
\documentclass[a4paper]{article}
\usepackage{multirow}
\begin{document}
\begin{table}[t]
\begin{center}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multirow{2}{*}{Number} & \multicolumn{4}{c}{Category} \\ \cline{2-5}
& \begin{tabular}{c} Very long category name \\ distributed on two rows \end{tabular} & cat.\ A & cat.\ B & \begin{tabular}{c} Another very long name \\ on two rows \end{tabular}\\
\hline
abc & def & ghi & jkl & mno\\
\hline
\end{tabular}
\end{center}
\end{table}
\end{document}
multicol
is for having text in multiple columns, it has nothing to do with tables. The macro\multicolumn
is defined in the LaTeX kernel.multicol
from my code!{c|}
not{c}