# Brackets in first column in table give “Missing number, treated as zero” error [duplicate]

Possible Duplicate:
Error with table

I'm writing a table with 4 columns and 1 row. The first column starts with a bracket. It compiles without issues:

\documentclass{article}
\begin{document}
\begin{tabular}{l l l l}
[k]bbb & def' & [h]bbb & def' \\
\end{tabular}
\end{document}


If I add another row like that, on the other hand, I receive an error message.

\documentclass{article}
\begin{document}
\begin{tabular}{l l l l}
[k]bbb & def' & [h]bbb & def' \\
[k]ccc & def' & [h]ccc & def' \\
\end{tabular}
\end{document}


! Missing number, treated as zero.

I can avoid the issue by adding some curly braces to the first column, but I'm curious what's going on with LaTeX and brackets in tables here.

-

## marked as duplicate by Werner, egreg, Seamus, David Carlisle, Peter GrillJul 20 '12 at 17:49

LaTeX sees the [ (from the second row) as the beginning of the optional argument for \\ and expects a length to follow; since the following token is k, an error is triggered. To prevent this, you can use braces:

\documentclass{article}
\begin{document}
\begin{tabular}{l l l l}
{[k]}bbb & def' & [h]bbb & def' \\
{[k]}ccc & def' & [h]ccc & def' \\
\end{tabular}
\end{document}


With only one row there's no problem (in fact, the braces around the [k] of the first row in my example can be suppressed) since there's no \\ before the character [.

-
Why doesn't this problem arise when there is only one row, though? –  Sverre Jul 20 '12 at 16:02
@Sverre With one row you dont have \\ before the [. –  Gonzalo Medina Jul 20 '12 at 16:02
@Sverre It's the second [ that causes the issue: the first one cannot be an optional argument as there is no preceding \\ . –  Joseph Wright Jul 20 '12 at 16:03