# ! Missing number, treated as zero, for creating table in Latex

I'm trying to create the following table. This is the code which I wrote.

\begin{table}[!htb]
\centering
\caption{"table1"}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
System & \multicolumn{2}{c}{Interaction} & \multicolumn{2}{c}{Commit} & Ver & LOC & terms \\\hline \multirow{3}{c}{System1} & \multicolumn{2}{c}{3272 traces} & \multicolumn{2}{c}{5093 revisions} & \multirow{3}{c}{3.4} & \multirow{3}{c}{1700} & \multirow{3}{c}{2400} \\\hline
& File & Method & File & Method & & & \\\hline
& 12 & 13 & 14 & 15 & & & \\\hline
\end{tabular}
\end{table}


and this the error that Latex shows:! Missing number, treated as zero.!

• Where exactly does it complain? At first sight, the above looks fine. – vonbrand Feb 1 '14 at 0:15
• first of fifth line. :( – Sara Feb 1 '14 at 0:16

The second argument for \multirow should be a length (representing the width to which the text is to be set) or * to indicate that the text argument’s natural width is to be used.

\documentclass{article}
\usepackage{multirow}

\begin{document}

\begin{table}[!htb]
\centering
\caption{"table1"}
\begin{tabular}{*{8}{|c}|}
\hline
System & \multicolumn{2}{c}{Interaction} & \multicolumn{2}{c}{Commit} & Ver & LOC & terms \\\hline \multirow{3}{*}{System1} & \multicolumn{2}{c}{3272 traces} & \multicolumn{2}{c}{5093 revisions} & \multirow{3}{*}{3.4} & \multirow{3}{*}{1700} & \multirow{3}{*}{2400} \\\hline
& File & Method & File & Method & & & \\\hline
& 12 & 13 & 14 & 15 & & & \\\hline
\end{tabular}
\end{table}

\end{document}


By the way, using vertical rules in tables might be frown upon. The booktabs package offers you features to increase the quality of your tables.

Here's a version using booktabs (and caption); notice that (at least, in my opinion) the table looks better without the \multirows:

\documentclass{article}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{multirow}

\begin{document}

\begin{table}[!htb]
\centering
\caption{"table1"}
\begin{tabular}{*{8}{c}}
\toprule
System & \multicolumn{2}{c}{Interaction} & \multicolumn{2}{c}{Commit} & Ver & LOC & terms \\
\midrule
System1 & \multicolumn{2}{c}{3272 traces} & \multicolumn{2}{c}{5093 revisions} & 3.4 & 1700 & 2400 \\
\cmidrule(r){2-3}\cmidrule(r){4-5}
& File & Method & File & Method & & & \\
\cmidrule(r){2-2}\cmidrule(lr){3-3}\cmidrule(lr){4-4}\cmidrule(l){5-5}
& 12 & 13 & 14 & 15 & & & \\
\midrule
System2 & \multicolumn{2}{c}{3272 traces} & \multicolumn{2}{c}{5093 revisions} & 3.4 & 1700 & 2400 \\
\cmidrule(r){2-3}\cmidrule(r){4-5}
& File & Method & File & Method & & & \\
\cmidrule(r){2-2}\cmidrule(lr){3-3}\cmidrule(lr){4-4}\cmidrule(l){5-5}
& 12 & 13 & 14 & 15 & & & \\
\bottomrule
\end{tabular}
\end{table}

\end{document}


• hey typing in parts doesn't count! I was first :P – percusse Feb 1 '14 at 0:18
• thanks, it works, why we should put *? – Sara Feb 1 '14 at 0:20
• @Sara I added the explanation for * in my answer. – Gonzalo Medina Feb 1 '14 at 0:21
• @Sara You're welcome! I added to my answer a version using booktabs that might be of interest for you. – Gonzalo Medina Feb 1 '14 at 0:31
• it looks nice, I used \cline{} to add a partial line for rows. But I have a problem with cell alignment, I want a vertical and horizontal centering for each cell. – Sara Feb 1 '14 at 0:57