0

The below tabularx table will only compile if it's empty.

\documentclass{article}
\usepackage{tabularx}
\begin{document}

A

\begin{tabularx}{0.5\linewidth}{|p|}
\hline
% foo           <-----
% \\ foo        <----- uncomment any of these lines, get an error
% foo \\        <-----
\end{tabularx}

B

\end{document}

The error is

Missing number, treated as zero.

What does this mean?

  • 3
    p requires a length argument. Probably you want X instead. – egreg Jun 16 '17 at 16:48
  • 1
    if you want to use p try with p{3cm}... it works! – koleygr Jun 16 '17 at 16:49
  • Thanks. Someone want to make that an answer so I can accept it? – spraff Jun 16 '17 at 17:04
2

If you try

\begin{tabular}{|p|}
\end{tabular}

you won't get an error, unless you load the array package, in which case you get

! Package array Error: Missing arg: token ignored.

The fact is that p requires a length argument, so the syntax is wrong notwithstanding the fact that an empty table raises no error.

The second argument to tabularx (the column specifiers) ought to contain at least an X column, or the environment would yield unexpected output.

In any case, p must be followed by {<length>}.

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.