這是我使用的套件和表格。其他模板也是如此。僅當我使用 KDD 模板 - acmart 時。我收到上述錯誤。
這是我使用的套件和表格:
\documentclass[sigconf]{acmart}
\usepackage{booktabs,makecell,tabularx}
\renewcommand\theadfont{\small}
\usepackage{siunitx}
\usepackage{adjustbox}
\usepackage{array,booktabs}
\usepackage{graphicx}
\usepackage{epstopdf}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\begin{table}
\centering
\setlength{\tabcolsep}{5pt}
\small
\begin{tabularx}{\columnwidth}{@{}c L S[table-format=7.0]*{2}{S[table-format=2.0]}@{}}
\toprule
\thead{ID} & \thead{DSA SDADD sdhjk}
& {\thead{ABC \\M}}
& {\thead{ABCD \\ minbucket }}
\\
\midrule
AB1 & ABCDE abcd & 30 & 250 \\
AB2 & ABCD & 40 & 500 \\
AB3 & ABCD ABCDE ABCDEFG ABCDEFGH ASDGFF & 2 & 500 \\
AB4 & ABC ABC 1000 & 40 & 7 \\
\bottomrule
\end{tabularx}
\caption{fsdjhkhsdk fhsdjkhdfsjkhkj fsdjhkhsdfk hjsdfhk}
\label{table:2}
\end{table}
\end{document}
答案1
我假設你打算L
定義如下,但我會絕不對於這樣的表的使用tabularx
,請參閱帶有 的版本tabular
。
tabularx
都是關於調整單元格內的換行符以適合表格,但您不希望在這樣的表格中換行並將其拉伸到全寬只會使其難以閱讀。
\documentclass[sigconf]{acmart}
\usepackage{booktabs,makecell,tabularx}
\renewcommand\theadfont{\small}
\usepackage{siunitx}
\usepackage{adjustbox}
\usepackage{array,booktabs}
\usepackage{graphicx}
\usepackage{epstopdf}
%\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\begin{document}
\begin{table}
\centering
\setlength{\tabcolsep}{5pt}
\small
\begin{tabularx}{\columnwidth}{@{}c L S[table-format=7.0]*{2}{S[table-format=2.0]}@{}}
\toprule
\thead{ID} & \thead{DSA SDADD sdhjk}
& {\thead{ABC \\M}}
& {\thead{ABCD \\ minbucket }}
\\
\midrule
AB1 & ABCDE abcd & 30 & 250 \\
AB2 & ABCD & 40 & 500 \\
AB3 & ABCD ABCDE ABCDEFG ABCDEFGH ASDGFF & 2 & 500 \\
AB4 & ABC ABC 1000 & 40 & 7 \\
\bottomrule
\end{tabularx}
\bigskip
\begin{tabular}{@{}c l*{2}{S[table-format=2.0]}@{}}
\toprule
\thead{ID} & \thead{DSA SDADD sdhjk}
& {\thead{ABC \\M}}
& {\thead{ABCD \\ minbucket }}
\\
\midrule
AB1 & ABCDE abcd & 30 & 250 \\
AB2 & ABCD & 40 & 500 \\
AB3 & ABCD ABCDE ABCDEFG ABCDEFGH ASDGFF & 2 & 500 \\
AB4 & ABC ABC 1000 & 40 & 7 \\
\bottomrule
\end{tabular}
\caption{fsdjhkhsdk fhsdjkhdfsjkhkj fsdjhkhsdfk hjsdfhk}
\label{table:2}
\end{table}
\end{document}