0

Why I have this error?

enter image description here

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}
2
  • 2
    Replace "c" with "S". Also, adapt the numbers according to the table content. For the second column, use 2.2 instead of 6, for the third c use, 1.4.
    – leandriis
    Aug 23 '20 at 2:37
  • LaTeX's basic l, c and r column types do not take arguments.
    – Mico
    Aug 23 '20 at 7:25
4

The c type column does not accept an optional argument, hence the error message you get. In order to make your code compilable, replace c with S. The latter is a column type defined by the siunitx package, which, among others accepts the table-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 of table-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:

enter image description here

\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}{
  @{}
  @{\extracolsep{\fill}}
  l
  S[table-format=2.2]
  S[table-format=1.4]
  S[table-format=1.4]
  S[table-format=1.4]
  @{}  
}
\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}

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.