1

I am trying to replicate the table like the below one.

I know I can use \toprule, \hline to add lines in the table. However, I do not know how a add a broken line in the table as row two and three shows between "A" and "B" or "B"& "C"

\begin{table}
  \caption{CAPTION}
  \label{tab:TABLENAME}
  \begin{tabular}{ccl}
    \toprule
      A & B & C\\
    \midrule
  
  \bottomrule
\end{tabular}
\end{table}

enter image description here

2
  • You could use an empty column.
    – gernot
    Aug 20 at 8:08
  • @gernot but the line between row 3 and 4 is continuous
    – S.F. Yeh
    Aug 20 at 8:09
1

You can use \cmidrule (from booktabs package) as in

\cmidrule(lr){2-3}

which will draw a line between columns 2 and 3, trimmed both left and right.

A complete example:

\documentclass{article}
\usepackage   {booktabs}
\usepackage   {lipsum} % for dummy text


\begin{document}
\lipsum[1]

\begin{table}[h]\centering
\caption{CAPTION\strut}\label{tab:TABLENAME}
\begin{tabular}{lcccccc}
\toprule
& \multicolumn{2}{c}{A} & \multicolumn{2}{c}{B} & \multicolumn{2}{c}{C}\\
\cmidrule(lr){2-3}\cmidrule(lr){4-5}\cmidrule(lr){6-7}
CATEGORIES & (1) & (2) & (1) & (2) & (1) & (2) \\
\midrule
GOOD & & & & & & \\
BAD  & & & & & & \\
\bottomrule
\end{tabular}
\end{table}

\lipsum[2]
\end{document}

enter image description here

1
  • perfecr thanks!
    – S.F. Yeh
    Aug 20 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.