I'm trying to produce a table in LaTeX and I almost succeed. The table is this one:
My question is: why the fourth column of "Gennaio", "Febbraio" and "Maggio" isn't as the same width as the rest? What do I need to modify in the code to overcome this problem?
The code is the following one:
\begin{table}[h]
\begin{tabular}{cllllllllllllllllllll}
\multicolumn{1}{c}{} & \multicolumn{4}{c}{GENNAIO} & \multicolumn{4}{c}{FEBBRAIO} & \multicolumn{4}{c}{MARZO} & \multicolumn{4}{c}{APRILE} & \multicolumn{4}{c}{MAGGIO} \\ \hline
\multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}Collezione\\ Dati\end{tabular}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} & \multicolumn{4}{l|}{} & \multicolumn{4}{l|}{} \\ \hline
\multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}Elaborazione\\ Dati\end{tabular}} & \multicolumn{4}{l|}{} & \multicolumn{4}{l|}{} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{4}{l|}{} \\ \hline
\multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}Report\\ Dati\end{tabular}} & \multicolumn{4}{l|}{} & \multicolumn{4}{l|}{} & \multicolumn{4}{l|}{} & \multicolumn{4}{l|}{} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} & \multicolumn{1}{l|}{\cellcolor[HTML]{9B9B9B}} \\ \hline
\end{tabular}
\end{table}
Thanks to anyone who has the patience to help me! R.
\halign
primitive, if a spanning cell is wider than the cells it spans all the width goes in the last spanned columnllllll
to*{16}{p{10mm}}
or whatever size works to force your columns equal width with 4 of them being just wider than your header text\usepackage{array, multirow}
\newcolumntype{C}{>{\centering\arraybackslash}p{3em}}
\begin{tabular}{*{21}{|C}|}
But the table width doesn't change. Maybe I just didn't understand your answer! @PrzemysławScherwentke Thank you for answering! For this table I'm using the following packages:\usepackage{graphicx, array, booktabs, multirow}
and I added this line in the preamble:\newcolumntype{C}{>{\centering\arraybackslash}p{3em}}