# Error with square bracket in table

\begin{table}[ht]
\makebox[\textwidth][c]{
\begin{tabular}{ccccc}
\hline
\hline
[] & [] & [] & [] & []\\
[] & [] & [] & [] & []\\
\hline
\hline
\end{tabular}
}
\caption{test}
\end{table}


I cannot run the above code, latex returned an error about missing number, but I can't see anything I am missing.

And the weirdest thing is that

\begin{table}[ht]
\makebox[\textwidth][c]{
\begin{tabular}{ccccc}
\hline
\hline
[] & [] & [] & [] & []\\
\hline
\hline
\end{tabular}
}
\caption{test}
\end{table}


This code works.

Anyone have any idea?

Since \\ allows an optional argument, the [ in the following line is mistaken for it.

......         \\\relax
[whatever] ... \\

• Thanks!! I was fighting against this error for half an hour. Nov 11, 2011 at 10:48
• I thought about this myself, and, as a workaround, tried to put a comment % after \\. To my surprise, it did not work. Could you enlighten me, why putting \\% does not solve this issue? May 21, 2021 at 6:17
• @Matsmath When \\ is seen, TeX will look whether * follows, gobbling spaces. Then it will look whether [ follows, still gobbling spaces. An endline is converted to a space, but with % it’s not even seen. Worse, in amsmath environments, the space gobbling fearure is disabled, so \\<newline>[ works, but \\%<newline>[ wouldn’t. May 21, 2021 at 8:40

Another option is to add brackets around, like this:

{[} .... {]}

• ...or add the braces before the next line, as in {} [...]`. In this case, either would work, but in some math situations, the spacing could come out differently. May 31, 2018 at 10:09