# Merging different cells in a table with \multicolumn

I am having troubles with \multicolumn. In the second row the cells containing a 9 should have equal sizes. How can I achieve this?

\documentclass{article}

\begin{document}
\begin{center}
\begin{tabular}{|c|cccccc|}
\hline
\textbf{faz} & \multicolumn{6}{c|}{18}\\
\hline
\textbf{bar} & \multicolumn{3}{c|}{9} & \multicolumn{3}{c|}{9}\\
\hline
\textbf{baz} & \multicolumn{2}{c|}{6} & \multicolumn{2}{c|}{6} &  \multicolumn{2}{c|}{6}\\
\hline
\end{tabular}
\end{center}

\end{document}


-

Yes, this behaviour is bizarre, but there is an explanation. Since you void the 6 column definition using \multicolumns in the second part of your column alignment specification, LaTeX has no idea what the alignment should be for that part of the table.

My suggestion would be to insert a dummy line with nothing in it that spans the entire width of the table, including every column entry. Then skip back (vertically) to typeset the remainder of your table. This will ensure LaTeX knows there's 6 columns that you want to split up in a 6/3-3/2-2-2 \multicolumn fashion.

Here is your minimal example with the correction:

\documentclass{article}

\begin{document}
\begin{center}
\begin{tabular}{|c|cccccc|}
\hline
\multicolumn{1}{c}{} & & & & & & \\[\dimexpr-\normalbaselineskip-\arrayrulewidth]% Correct for mis-alignment
\textbf{faz} & \multicolumn{6}{c|}{18}\\
\hline
\textbf{bar} & \multicolumn{3}{c|}{9} & \multicolumn{3}{c|}{9}\\
\hline
\textbf{baz} & \multicolumn{2}{c|}{6} & \multicolumn{2}{c|}{6} &  \multicolumn{2}{c|}{6}\\
\hline
\end{tabular}
\end{center}

\end{document}

-