我有一张表格,我想让它看起来像下面的第二个表格,其中的线条只在红色处。我想删除所有黑线。我浏览了几个帖子,但没有一个能解决这个问题。这是我目前拥有的,但我完全不知道如何继续。
\begin{table}[t]
\small
\begin{tabu} to \textwidth { | X[l] | X[c] | X[c] | X[c] | X[c] | X[c] |}
\hline
& \multicolumn{5}{c|}{Precision with label shifted by t seconds} \\
\cline{5-6}
& 0 & 1 & 2 & 3 & 4\\
\hline
Ours & 0.143 & 0.143 & & & \\
CNN & 1.518 & 1.518 \\
JAAD & 0.018 & 0.142 \\
Keypoints & 0.029 & 0.180 \\
\hline
\end{tabu}
\medskip
\caption{Time taken to generate a single scale of 100 superpixels and a hierarchy at 100, 150, 200, 300, 400, and 600 superpixels.}
\label{tab:runtime}
\end{table}
答案1
像这样?
\documentclass{article}
\usepackage{tabu}
\begin{document}
\begin{table}[t]
\small
\begin{tabu} to \textwidth { X[l] | X[c] X[c] X[c] X[c] X[c] }
% \hline
& \multicolumn{5}{c}{Precision with label shifted by t seconds} \\
% \cline{5-6}
& 0 & 1 & 2 & 3 & 4\\
\hline
Ours & 0.143 & 0.143 & & & \\
CNN & 1.518 & 1.518 \\
JAAD & 0.018 & 0.142 \\
Keypoints & 0.029 & 0.180 \\
% \hline
\end{tabu}
\medskip
\caption{Time taken to generate a single scale of 100 superpixels and a hierarchy at 100, 150, 200, 300, 400, and 600 superpixels.}
\label{tab:runtime}
\end{table}
\end{document}
答案2
我会避免tabu
并使用siunitx
以确保正确处理数字。
\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}
Table~\ref{tab:runtime-BETTER} is better than Table~\ref{tab:runtime}.
\begin{table}[htp]
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}\hspace{\tabcolsep}}
l|
*{5}{S[table-format=1.3]}
}
& \multicolumn{5}{c}{Precision with label shifted by $t$ seconds} \\
& {0} & {1} & {2} & {3} & {4} \\
\hline
Ours & 0.143 & 0.143 & 0.111 & 0.222 & 0.333 \\
CNN & 1.518 & 1.518 \\
JAAD & 0.018 & 0.142 \\
Keypoints & 0.029 & 0.180 \\
\end{tabular*}
\caption{Time taken to generate a single scale of 100 superpixels
and a hierarchy at 100, 150, 200, 300, 400, and 600 superpixels.}
\label{tab:runtime}
\end{table}
\begin{table}[htp]
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}\hspace{\tabcolsep}}
l
*{5}{S[table-format=1.3]}
@{}
}
\toprule
& \multicolumn{5}{c}{Precision with label shifted by $t$ seconds} \\
\cmidrule{2-6}
& {0} & {1} & {2} & {3} & {4} \\
\midrule
Ours & 0.143 & 0.143 & 0.111 & 0.222 & 0.333 \\
CNN & 1.518 & 1.518 \\
JAAD & 0.018 & 0.142 \\
Keypoints & 0.029 & 0.180 \\
\bottomrule
\end{tabular*}
\caption{Time taken to generate a single scale of 100 superpixels
and a hierarchy at 100, 150, 200, 300, 400, and 600 superpixels.}
\label{tab:runtime-BETTER}
\end{table}
\end{document}
在我看来,第二种格式更好。