20
\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?

25

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

......         \\\relax
[whatever] ... \\
| improve this answer | |
  • Thanks!! I was fighting against this error for half an hour. – Benjamin Nov 11 '11 at 10:48
6

Another option is to add brackets around, like this:

{[} .... {]}
| improve this answer | |
  • 1
    ...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. – Steven B. Segletes May 31 '18 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.