I'm using a program to generate LaTeX code utilize the tabular package. It creates an error that reads

! Missing number, treated as zero.
<to be read again> 
l.17 \begin{tabularx} {#}
                          {@{} l Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y@{}} \\

The code I'm using is as follows:

\documentclass[11pt, oneside]{article} 

\title{Brief Article}
\author{The Author}


\begin{tabularx} {#} {@{} l Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y@{}} \\
 & \multicolumn{2}{c}{\textbf{surveyseason}} \\
&\textbf{1}&\textbf{} \\
&Col \%&Col \% \\
\textbf{sex}&& \\
female&45.3&47.2 \\
male&54.5&56.8 \\
\textbf{grade}&& \\
9th&29&23 \\
10th&26&25 \\
11th&12.8&2.5 \\
12th&2.8&21.3 \\
\textbf{ethbest}&& \\
american indian or alaska native&3.9&3.9 \\
native hawaiian or pacific islander&1.6&1.6 \\
asian american&9.8&9.8 \\
white or caucasian&60.4&60.4 \\
other&8.8&8.8 \\
\textbf{highsch}&& \\
san dieguito&17.6&17.6 \\
torrey pines&33.5&33.5 \\
lacosta canyon&29.0&29.0 \\
canyon crest&19.8&19.8 \\
\scriptsize{\emph{Source: }test.dta}


1 Answer 1


The first argument of the tabularx environment should be the width that the tabularx should span. In your case, you passed it a length #, which is incorrect. Instead, pass it something like \linewidth:


The usage/notation is mentioned in the tabularx documentation:


Since this is program-generated output, you'll either have to update the measurement manually (in the TeX output), or from the program of course.

Other manual improvements could include

  • using the *{<num>}{<colspec>} notation for repeating a column specification <col spec> a total of <num> times. So

    \begin{tabularx}{\linewidth}{@{} l Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y@{}}

    will change into

    \begin{tabularx}{\linewidth}{@{} l *{16}{Y} @{}}

    It is somewhat strange that you're listing a large number of columns in your tabularx column specification, yet you're only using three ever.

  • Not using \\ as the first line of your tabularx.

Note the use of \noindent to avoid an overfull \hbox warning.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .