不使用调整大小框即可防止表格溢出列

不使用调整大小框即可防止表格溢出列

我想在不使用resizebox的情况下阻止这个表向右溢出。

\documentclass[xcolor=table,sigconf,review,anonymous]{acmart}
\usepackage{booktabs, makecell, multirow, tabularx}
\usepackage{siunitx}

\begin{document}

\title{test}
\maketitle

\begin{table}[!htb]
   \caption{Number of requirements with seeded errors for which predictions could/could not be computed.}
\label{tab:dataPoints}
\begin{tabular}{|r|r|r|r|r|r|r|r|r|r|r|}
\hline
\multicolumn{1}{|c|}{\multirow{3}{*}{}} & \multicolumn{5}{c|}{T->N} & \multicolumn{5}{c|}{N->T} \\ \cline{2-11} 
\multicolumn{1}{|c|}{} & \multicolumn{2}{c|}{T trace} & \multicolumn{2}{c|}{N trace} & \multicolumn{1}{c|}{\multirow{2}{*}{Tot.}} & \multicolumn{2}{c|}{T trace} & \multicolumn{2}{c|}{N trace} & \multicolumn{1}{c|}{\multirow{2}{*}{Tot.}} \\ \cline{2-5} \cline{7-10}
\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{\checkmark} & \multicolumn{1}{c|}{x} & \multicolumn{1}{c|}{\checkmark} & \multicolumn{1}{c|}{x} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\checkmark} & \multicolumn{1}{c|}{x} & \multicolumn{1}{c|}{\checkmark} & \multicolumn{1}{c|}{x} & \multicolumn{1}{c|}{} \\ \hline
]0-20[ & 71 & 1 & 72 & 0 & 72 & 132 & 17 & 149 & 0 & 149 \\ \hline
[20-40[ & 129 & 51 & 180 & 0 & 180 & 167 & 18 & 185 & 0 & 185 \\ \hline
[40-60[ & 121 & 67 & 188 & 0 & 188 & 157 & 16 & 173 & 0 & 173 \\ \hline
[60-80[ & 87 & 71 & 158 & 0 & 158 & 156 & 13 & 169 & 0 & 169 \\ \hline
[80-100] & 36 & 146 & 182 & 0 & 182 & 161 & 13 & 148 & 26 & 174 \\ \hline
\end{tabular}
\end{table}

\end{document}

答案1

三个版本使用了不同的 值\tabcolsep、不同的字体大小以及不同的横线和竖线:

在此处输入图片描述

\documentclass[xcolor=table,sigconf,review,anonymous]{acmart}
\usepackage{booktabs, makecell, multirow, tabularx}
\usepackage{siunitx}

\begin{document}

\title{test}
\maketitle

\begin{table}[!htb]
   \caption{Number of requirements with seeded errors for which predictions could/could not be computed.}
   \setlength{\tabcolsep}{4.25pt}
\label{tab:dataPoints}
\begin{tabular}{|r|r|r|r|r|r|r|r|r|r|r|}
\hline
\multicolumn{1}{|c|}{\multirow{3}{*}{}} & \multicolumn{5}{c|}{T->N} & \multicolumn{5}{c|}{N->T} \\ \cline{2-11} 
\multicolumn{1}{|c|}{} & \multicolumn{2}{c|}{T trace} & \multicolumn{2}{c|}{N trace} & \multicolumn{1}{c|}{\multirow{2}{*}{Tot.}} & \multicolumn{2}{c|}{T trace} & \multicolumn{2}{c|}{N trace} & \multicolumn{1}{c|}{\multirow{2}{*}{Tot.}} \\ \cline{2-5} \cline{7-10}
\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{\checkmark} & \multicolumn{1}{c|}{x} & \multicolumn{1}{c|}{\checkmark} & \multicolumn{1}{c|}{x} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\checkmark} & \multicolumn{1}{c|}{x} & \multicolumn{1}{c|}{\checkmark} & \multicolumn{1}{c|}{x} & \multicolumn{1}{c|}{} \\ \hline
]0-20[ & 71 & 1 & 72 & 0 & 72 & 132 & 17 & 149 & 0 & 149 \\ \hline
[20-40[ & 129 & 51 & 180 & 0 & 180 & 167 & 18 & 185 & 0 & 185 \\ \hline
[40-60[ & 121 & 67 & 188 & 0 & 188 & 157 & 16 & 173 & 0 & 173 \\ \hline
[60-80[ & 87 & 71 & 158 & 0 & 158 & 156 & 13 & 169 & 0 & 169 \\ \hline
[80-100] & 36 & 146 & 182 & 0 & 182 & 161 & 13 & 148 & 26 & 174 \\ \hline
\end{tabular}
\end{table}


\begin{table}[!htb]
   \caption{Number of requirements with seeded errors for which predictions could/could not be computed.}
  \small
\label{tab:dataPoints}
\begin{tabular}{|r|r|r|r|r|r|r|r|r|r|r|}
\hline
\multicolumn{1}{|c|}{\multirow{3}{*}{}} & \multicolumn{5}{c|}{T->N} & \multicolumn{5}{c|}{N->T} \\ \cline{2-11} 
\multicolumn{1}{|c|}{} & \multicolumn{2}{c|}{T trace} & \multicolumn{2}{c|}{N trace} & \multicolumn{1}{c|}{\multirow{2}{*}{Tot.}} & \multicolumn{2}{c|}{T trace} & \multicolumn{2}{c|}{N trace} & \multicolumn{1}{c|}{\multirow{2}{*}{Tot.}} \\ \cline{2-5} \cline{7-10}
\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{\checkmark} & \multicolumn{1}{c|}{x} & \multicolumn{1}{c|}{\checkmark} & \multicolumn{1}{c|}{x} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\checkmark} & \multicolumn{1}{c|}{x} & \multicolumn{1}{c|}{\checkmark} & \multicolumn{1}{c|}{x} & \multicolumn{1}{c|}{} \\ \hline
]0-20[ & 71 & 1 & 72 & 0 & 72 & 132 & 17 & 149 & 0 & 149 \\ \hline
[20-40[ & 129 & 51 & 180 & 0 & 180 & 167 & 18 & 185 & 0 & 185 \\ \hline
[40-60[ & 121 & 67 & 188 & 0 & 188 & 157 & 16 & 173 & 0 & 173 \\ \hline
[60-80[ & 87 & 71 & 158 & 0 & 158 & 156 & 13 & 169 & 0 & 169 \\ \hline
[80-100] & 36 & 146 & 182 & 0 & 182 & 161 & 13 & 148 & 26 & 174 \\ \hline
\end{tabular}
\end{table}


\begin{table}[!htb]
   \caption{Number of requirements with seeded errors for which predictions could/could not be computed.}
   \setlength{\tabcolsep}{4.5pt}
\label{tab:dataPoints}
\begin{tabular}{@{}rrrrrrrrrrr@{}}
\toprule
 & \multicolumn{5}{c}{T->N} & \multicolumn{5}{c}{N->T} \\ 
\cmidrule(r){2-6} \cmidrule(l){7-11} 
 & \multicolumn{2}{c}{T trace} & \multicolumn{2}{c}{N trace} & \multirow{2}{*}{Tot.} & \multicolumn{2}{c}{T trace} & \multicolumn{2}{c}{N trace} & \multicolumn{1}{c}{\multirow{2}{*}{Tot.}} \\ 
\cmidrule{2-5} \cmidrule{7-10}
 & \multicolumn{1}{c}{\checkmark} & \multicolumn{1}{c}{x} & \multicolumn{1}{c}{\checkmark} & \multicolumn{1}{c}{x} &  & \multicolumn{1}{c}{\checkmark} & \multicolumn{1}{c}{x} & \multicolumn{1}{c}{\checkmark} & \multicolumn{1}{c}{x}  \\ 
\midrule
]0-20[ & 71 & 1 & 72 & 0 & 72 & 132 & 17 & 149 & 0 & 149 \\{} 
[20-40[ & 129 & 51 & 180 & 0 & 180 & 167 & 18 & 185 & 0 & 185 \\{} 
[40-60[ & 121 & 67 & 188 & 0 & 188 & 157 & 16 & 173 & 0 & 173 \\{} 
[60-80[ & 87 & 71 & 158 & 0 & 158 & 156 & 13 & 169 & 0 & 169 \\ {}
[80-100] & 36 & 146 & 182 & 0 & 182 & 161 & 13 & 148 & 26 & 174 \\ 
\bottomrule
\end{tabular}
\end{table}

\end{document}

相关内容