%3A%20%60c%60%20%E3%81%8C%E4%BD%BF%E7%94%A8%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99.png)
なぜこのエラーが発生するのでしょうか?
私の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}
答え1
列c
の型はオプションの引数を受け入れないため、エラー メッセージが表示されます。コードをコンパイル可能にするには、c
を に置き換えます。S
後者はsiunitx
パッケージによって定義された列の型で、特に、table-format
使用したオプションを受け入れます。数字の配置と列幅を正しくするには、table-format
対応するテーブル列の内容に応じて の値も修正する必要があります。次の例では、列が均等に分散されている一方で、テーブルが指定された幅と同じ幅になるように も追加しました@{\extracolsep{\fill}}
。
\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}