Why I have this error?
My MWE:
\documentclass[12pt,oneside]{book}
\usepackage[showframe]{geometry}
\usepackage{amsmath}
\usepackage{ragged2e}
\usepackage{booktabs, makecell, multirow, tabularx,
threeparttable, tabulary}
\renewcommand\theadfont{\small\bfseries} % for bold in table using \small
\renewcommand\theadgape{}
\usepackage[svgnames, table]{xcolor}
\usepackage{siunitx} %for table spacing to second row
\usepackage{graphicx}
\usepackage[font=small,
labelfont={bf,sf}, textfont={sf},
justification=centering]{caption}
\begin{document}
\begin{table}[h!]
\centering
\begin{tabular*}{0.80\textwidth}{
@{}
l
c[table-format=6]
c[table-format=6]
c[table-format=6]
c[table-format=6]
@{}
}
\toprule
{\thead{Sample Setting \\ Configuration}}
& {\thead{Verification \\
Status}}
& {\thead{Precision \\ (\textit{P})}}
& {\thead{Recall \\ (\textit{R}) }}
& {\thead{\textit{F}-samples }} \\
\midrule
No. 4 & 66.07 & 0.6786 & 0.6552 & 0.6667 \\
No. 5 & 71.43 & 0.7097 & 0.7586 & 0.7333 \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
Best Answer
The
c
type column does not accept an optional argument, hence the error message you get. In order to make your code compilable, replacec
withS
. The latter is a column type defined by thesiunitx
package, which, among others accepts thetable-format
option that you used. In order to get the correct alignment of the numbers, as well as the right column widths, you should also correct the values oftable-format
according to the contents of the corresponding table columns. In the following example, I have also added@{\extracolsep{\fill}}
in order to make sure the table is as wide as the specified width, while the columns are spread evenly: