下列的 适合其余纸张宽度的表格 我的问题,我使用 amcs 模板amcs模板 以及以下内容:
\documentclass{amcs}
\usepackage{booktabs,makecell,tabularx}
\renewcommand\theadfont{\small}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{siunitx}
%\documentclass{article}
\usepackage{adjustbox}
\usepackage{array,booktabs}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\documentclass{article}
\usepackage{booktabs,makecell,tabularx}
\renewcommand\theadfont{\small}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{siunitx}
\begin{document}
\begin{table}[H]
\centering
\setlength{\tabcolsep}{1pt}
\small
\begin{tabularx}{\textwidth}{c L S[table-format=0.1]*{2}{S[table-format=0.1]}}
\toprule
\thead{ID} & \thead{UCI Dataset Name}
& {\thead{Samples\\(number)}}
& {\thead{Attributes\\(number)}}
& {\thead{Classes\\(number)}} \\
\midrule
DS1 & Poker Hand & 1025010 & 11 & 9 \\
DS2 & SUSY & 5000000 & 18 & 2 \\
DS3 & Record Linkage Comparison Patterns & 5749132 & 9 & 2 \\
DS4 & KDD Cup 1999 & 4898431 & 42 & 23 \\
\bottomrule
\end{tabularx}
\caption{Datasets used for empirical evaluation}
\label{table:1}
\end{table}
\end{document}
答案1
将表格的第一行替换为:
\begin{tabularx}{\columnwidth}{@{}c L S[table-format=7.0]*{2}{S[table-format=2.0]}@{}}
结果将会是这样的:
编辑: 使用以下方法可以获得稍微好一点的结果:
\begin{table}[htb]
\centering
\setlength{\tabcolsep}{2pt}
\small
\begin{tabularx}{\columnwidth}{@{}c L S[table-format=7.0]*{2}{S[table-format=2.0]}@{}}
\toprule
\thead{ID} & \thead{UCI Dataset Name}
& {\thead{Samples\\(num.)}}
& {\thead{Attributes\\(num.)}}
& {\thead{Classes\\(num.)}} \\
\midrule
DS1 & Poker Hand & 1025010 & 11 & 9 \\
DS2 & SUSY & 5000000 & 18 & 2 \\
DS3 & Record Linkage Comparison Patterns & 5749132 & 9 & 2 \\
DS4 & KDD Cup 1999 & 4898431 & 42 & 23 \\
\bottomrule
\end{tabularx}
\caption{Datasets used for empirical evaluation}
\label{table:1}
\end{table}
答案2
或者你可以像\resizebox
这样使用:
\begin{table}[htb]
\resizebox{\columnwidth}{!}{
\begin{tabular}{|c|c|c|c|}
column1 & column2 & column3 & column4 \\
\hline
data1 & data2 & data3 & data4 \\
\hline
\end{tabular}
}
\end{table}