这是我使用的包和表格。其他模板也一样。只有当我使用 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}