0

I have this script:

\documentclass[letterpaper,twocolumn,10pt]{article}
\usepackage{graphicx}
\usepackage{array,tabularx}
\usepackage{multirow,booktabs} %
\usepackage{pifont}% 
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\usepackage{array,tabularx}

\begin{document}


\begin{table}[h]\centering
\begin{tabular}{lccccc}
\toprule
\multicolumn{2}{c}{SSS } & \multicolumn{3}{c}{HHH} \\
\cmidrule(lr){1-2} \cmidrule(r){3-5}
 & & TTT \\

\cmidrule(lr){1-2} \cmidrule(lr){3-5}
 AAA & BBB & CCC & DDD \\

\midrule
1 & 2 & 3 & 4 &  5 \\

\bottomrule
\end{tabular}
\end{table}



\end{document}

The output is:

enter image description here

I want to make it looks like: enter image description here

I also want to make the colors of the horizontal lines in the second and third line to be grey. Can you help please?

1

Like that?

\documentclass[letterpaper,twocolumn,10pt]{article}
\usepackage{booktabs}
\usepackage{xcolor}
\usepackage{colortbl}

\begin{document}

\begin{table}[h]\centering
\begin{tabular}{lccccc}
\toprule
\arrayrulecolor{gray}
\multicolumn{2}{c}{SSS} & \multicolumn{3}{c}{HHH} \\
\cmidrule(lr){1-2} \cmidrule(r){3-5}
\multicolumn{2}{c}{} & \multicolumn{3}{c}{TTT} \\
\cmidrule(lr){3-5}
\arrayrulecolor{black}
AAA & BBB & CCC & DDD \\
\midrule
1 & 2 & 3 & 4 &  5 \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

I also cleaned the example to the bare minimum. Also, you load array and tabularx twice.

  • Thanks. How can I color the lines in the 2nd and 3rd line to grey instead of clack? – user6875880 Nov 29 '16 at 16:12
  • @user6875880 Code changed. Now you also get the colour change. I missed that part of the question. – Manuel Weinkauf Nov 29 '16 at 16:14
  • After update, the code does not compile and gives: text.tex(9): Error: Undefined control sequence. text.tex(10): Error: Misplaced \omit. – user6875880 Nov 29 '16 at 16:23
  • @user6875880 Exactly this code? It runs without any problem on my system, I cannot reproduce your error. Are you sure that all necessary packages are installed and up-to-date? Depending on your configuration they may not be installed on the fly if missing, or may not work together properly if some are installed in a very old version. – Manuel Weinkauf Nov 29 '16 at 16:31

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.