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

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

  • 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 Aug 27 '18 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. – Lars Halbauer Aug 27 '18 at 14:29
  • Oh, yes, indeed, thank you! I got confused with the different table packages, as I am quite new to LaTex. – Fraenzine Aug 27 '18 at 14:32

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.