# Multicolumn 3 out of 6 doesn't work

I'm trying to make a multicolumn in a 7 columns tabular.

\documentclass{article}
\begin{document}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
& \multicolumn{6}{c|}{Parameters}\\
\hline
We don't care * & \multicolumn{2}{l|}{cause it's a test} & \multicolumn{2}{l|}{cause it's a test} & \multicolumn{2}{l|}{cause it's a test}\\
\hline
Punctuation ? & \multicolumn{3}{c|}{yes+} & empty & empty & empty \\ %& \multicolumn{3}{c|}{no}\\
\hline
\end{tabular}
\end{document}


The "yes" cell is not working, I have a small cell (1 column) and a large "empty" right after it. The last two empties are ok.

-
Welcome to TeX.SE! It's very helpful for readers of postings if people post not only code snippets but compilable minimum working examples (MWEs) that illustrate the issue at hand. I've taken the liberty of adding two lines of code at the top and one line at the bottom of your code to convert it into an MWE. –  Mico Jun 16 '12 at 11:03

When you have columns that are spanned in every row the underlying \halign primitive essentially removes the column from the calculation:

\documentclass{article}

\begin{document}

\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
& \multicolumn{6}{c|}{Parameters}\\
\hline
We don't care * & \multicolumn{2}{l|}{cause it's a test} & \multicolumn{2}{l|}{cause it's a test} & \multicolumn{2}{l|}{cause it's a test}\\
\hline
Punctuation ? & \multicolumn{3}{c|}{yes+} & empty & empty & empty \\ %& \multicolumn{3}{c|}{no}\\
\hline
1&2&3&4&5&6&7
\end{tabular}

\end{document}

-

The problem comes from the fact that at not point in your table all the columns are used independently for the compiler to calculate their with. This is why, with @david-carlisle's answer, as soon as he adds a line with all the cells independently used, the layout changes.

If you want more control over your table you can use an environment which lets you set the width of them such as tabu or tabularx. but even there, without help, the environment will not know what to do.

\documentclass[a4paper,12pt]{standalone}
\usepackage{tabu}
\begin{document}
\begin{tabu}{|l|X|X|X|X|X|X|}
\hline
& \multicolumn{6}{c|}{Parameters}\\
\hline
We don't care * & \multicolumn{2}{l|}{cause it's a test} & \multicolumn{2}{l|}{cause it's a test} & \multicolumn{2}{l|}{cause it's a test}\\
\hline
Punctuation ? & \multicolumn{3}{c|}{yes+} & empty & empty & empty \\ %& \multicolumn{3}{c|}{no}\\
\hline
\end{tabu}

\end{document}


will give you

The tabu package gives you the \tabuphantomline so that cell widths can be calculated properly without printing anything:

\documentclass[a4paper,12pt]{standalone}
\usepackage{tabu}
\begin{document}
\begin{tabu}{|l|X|X|X|X|X|X|}
\hline
\tabuphantomline
& \multicolumn{6}{c|}{Parameters}\\
\hline
We don't care * & \multicolumn{2}{l|}{cause it's a test} & \multicolumn{2}{l|}{cause it's a test} & \multicolumn{2}{l|}{cause it's a test}\\
\hline
Punctuation ? & \multicolumn{3}{c|}{yes+} & empty & empty & empty \\ %& \multicolumn{3}{c|}{no}\\
\hline
\end{tabu}

\end{document}


which then gives you something probably more akin to what you were expecting:

tabu and tabularx add the X column type for which the column width is calculated so that all X cells have the same dimension (although multiplier are also possible). So for you example, having the last 6 columns as X column would probably make sense.

-

The reason the tabular example is throwing an error is that its basic setup is overspecified: It's set to have 7 columns overall, but the two lines only contain 4 and 5 columns, respectively. Digging deeper, one quickly finds that whereas the first column and the last two columns are identified uniquely by the setup you provide, columns 2 through 5 are not. There are too many degrees of freedom at the moment; what you're discovering is that LaTeX is unable to come up with the correct "guess" as to how you would like the columns to be grouped into multicolumns.

This may be verified by adding a "trivial" row such as

a & b & c & d & e & f & g\\