Graphics, Figures & TablesMissing number, treated as zero. \end{tabularx}

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
AndyStoeckli
Posts: 2
Joined: Fri Jan 11, 2019 9:57 am

Missing number, treated as zero. \end{tabularx}

Post by AndyStoeckli »

Hi all,

I'm new in this forum but use LaTex for a long time. With the newest update for MikTex (downloaded from the website yesterday) I have now faced a problem with the following kind of table.

Code: Select all

\usepackage{tabularx}	% Tablex has a special specifier (X) for strechting the table width
\usepackage{color,colortbl}

\begin{center}
	\begin{scriptsize}
		\rowcolors{1}{White}{Gray}
		\setcounter{cTestStep}{1}
		\captionsetup{type=table}
		\begin{tabularx}{0.9\textwidth}{p{0.05\textwidth}p{0.1\textwidth}p{0.1\textwidth}Xp{0.05\textwidth}p{0.2\textwidth}}
			\toprule
			\textbf{Ref}            & \textbf{Document type} & \textbf{Document number} & \textbf{Name}               & \textbf{Rev.} & \textbf{Content}       \\ \midrule
			\printandinc{cTestStep} & pdf                    & -                        & VBE-Comicon\_protocol\_ver0\_3 & 0.3           & Communication protocol \\
			\printandinc{cTestStep} &                        &                          &                             &               &                        \\
			\printandinc{cTestStep} &                        &                          &                             &               &                        \\
			\printandinc{cTestStep} &                        &                          &                             &               &                        \\ \bottomrule
		\end{tabularx}
  		\caption{\label{Applicable documents}Applicable documents}
		\end{scriptsize}
\end{center}
Now, the complete document gives a huge amount of errors back. Removing \rowcolors solves the problem but then with the lack of coulored rows.

Code: Select all

Error Message:
Missing number, treated as zero. \end{tabularx}
Illegal unit of measure (pt inserted). \end{tabularx}
Thanks in advance for your help.

Best regards
Andy
Last edited by Stefan Kottwitz on Fri Jan 11, 2019 4:51 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
Stefan Kottwitz
Site Admin
Posts: 10311
Joined: Mon Mar 10, 2008 9:44 pm

Missing number, treated as zero. \end{tabularx}

Post by Stefan Kottwitz »

Hi Andy,

welcome to the forum!

In the code above there are some details missing, such as which packages are needed and loaded (booktabs and caption are required), the counter definition for cTestStep, and the definition of \printandinc.

If I try to re-create the missing stuff, the error doesn't appear:

Code: Select all

\documentclass[12pt]{article}
\usepackage{tabularx}	% Tablex has a special specifier (X) for strechting the table width
\usepackage{color,colortbl}
\newcounter{cTestStep}
\usepackage{caption}
\usepackage{booktabs}
\begin{document}
\begin{center}
	\begin{scriptsize}
		%\rowcolor{1}{White}{Gray}
		\setcounter{cTestStep}{1}
		\captionsetup{type=table}
		\begin{tabularx}{0.9\textwidth}{p{0.05\textwidth}p{0.1\textwidth}p{0.1\textwidth}Xp{0.05\textwidth}p{0.2\textwidth}}
			\toprule
			\textbf{Ref}            & \textbf{Document type} & \textbf{Document number} & \textbf{Name}               & \textbf{Rev.} & \textbf{Content}       \\ \midrule
			\thecTestStep\stepcounter{cTestStep} & pdf                    & -                        & VBE-Comicon\_protocol\_ver0\_3 & 0.3           & Communication protocol \\
			\thecTestStep\stepcounter{cTestStep} &                        &                          &                             &               &                        \\
			\thecTestStep\stepcounter{cTestStep} &                        &                          &                             &               &                        \\
			\thecTestStep\stepcounter{cTestStep} &                        &                          &                             &               &                        \\ \bottomrule
		\end{tabularx}
  		\caption{\label{Applicable documents}Applicable documents}
		\end{scriptsize}
\end{center}
\end{document}
It compiles without problems. So perhaps you are doing something else in addition? Can you post a complete small code example that brings the error when we compile it, based on your code?

Stefan
LaTeX.org admin
AndyStoeckli
Posts: 2
Joined: Fri Jan 11, 2019 9:57 am

Missing number, treated as zero. \end{tabularx}

Post by AndyStoeckli »

Dear Stefan,

I'm currently out of office, but as soon as I'm back I'll send you a code example. Meanwhile I tried also texlive and with this compiler everything worked fine. Also with the old MikTex compiler everything is working fine. It's really strange

Best regards
Andy
Post Reply