%3A%20%60c%60%20usado.png)
¿Por qué tengo este error?
Mi 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}
Respuesta1
La c
columna de tipo no acepta un argumento opcional, de ahí el mensaje de error que aparece. Para que su código sea compilable, reemplácelo c
con S
. Este último es un tipo de columna definida por el siunitx
paquete, que, entre otras, acepta la table-format
opción que hayas utilizado. Para obtener la alineación correcta de los números, así como el ancho de columna correcto, también debe corregir los valores de table-format
acuerdo con el contenido de las columnas correspondientes de la tabla. En el siguiente ejemplo, también agregué @{\extracolsep{\fill}}
para asegurarme de que la tabla tenga el ancho especificado, mientras que las columnas estén distribuidas uniformemente:
\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}