3

I have a table that I am trying to generate to look like the second one below where the lines are only at the red. I want to remove all the black lines. I have gone through several threads and none of them have a solution for this exact problem. Here is what I currently have but I have 0 idea how to proceed from this.

\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}

enter image description here

3
  • \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\\ Ours & 0.143 & 0.143 & & & \\ CNN & 1.518 & 1.518 \\ JAAD & 0.018 & 0.142 \\ Keypoints & 0.029 & 0.180 \\ \hline \end{tabu}
    – user121799
    May 16, 2019 at 19:09
  • @marmot Does that remove the red lines and not the black? Kong: Why do you have the \hline and \cline in there in the first place? They're the ones making your lines (and the |).
    – Teepeemm
    May 16, 2019 at 19:13
  • @Teepeemm Yes, I think so.
    – user121799
    May 16, 2019 at 19:16

2 Answers 2

4

Like this?

\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}

enter image description here

3

I'd avoid tabu and use siunitx to ensure proper treatment of the numbers.

\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}

The second format is nicer, in my opinion.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .