1

When making a table in Latex with "tabular", I always get the following errors:

  • "Missing number, treated as zero \begin{tabular}"
  • "Illegal unit of measure (pt inserted) \begin{tabular}"

This is the table:

\\
\begin{table}[h!]
\centering
\renewcommand{\arraystretch}{1.5}
\caption{xx}
\footnotesize
\textwidth
\begin{tabular}{|c||c|c|c|c|c|c|}
\hline
\textbf{1}   & \textbf{1}        & \textbf{3}     & \4       & 5      & 6      & 7       \\ \hline \hline
a        & b             & c              & d              & e             & f             & g              \\ \hline
\end{tabular}
\end{table}

1 Answer 1

1

You should remove the '\textwidth' from your code.

3
  • Could you explain me please what \textwidth is exactly doing and why it leads to the error? I had used it because I tried to put the table to fit the width of my text, but this attempt failed :(
    – Fraenzine
    Commented Aug 27, 2018 at 13:45
  • The \textwidth command is used, if you use e. g. the tabularx-package like this: \begin{tabularx}[>width< (e.g. \textwidth] ... tablecode \end{tabularx} Then, the table can be fit to the text. This is exceptionally useful, when you have a document with more than one column. Commented Aug 27, 2018 at 14:29
  • Oh, yes, indeed, thank you! I got confused with the different table packages, as I am quite new to LaTex.
    – Fraenzine
    Commented Aug 27, 2018 at 14:32

You must log in to answer this question.

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