2

I want to add background color in the header part of my table which contains grouped columns:

\multicolumn{8}{ p{6.0in} }{ \textbf{ PARTNER } } & \hfill\textbf{ TOTAL PAYABLES }  \\

A simple \rowcolor does not color the whole row but the ungrouped column only. How to color the whole row?

  • 1
    if you have a colortbl dated 2012 it should work – David Carlisle Sep 10 '13 at 7:15
  • or if not use \cellcollor{blue} – David Carlisle Sep 10 '13 at 8:08
5

Using xcolor package:

\documentclass{report}
\usepackage[table]{xcolor}
\begin{document}
\noindent
\begin{table}
  \begin{tabular}{|*9{c|}}
    \rowcolor{gray!30}\multicolumn{8}{ |p{4.0in}|}{ \textbf{ PARTNER } } & \textbf{TOTAL PAYABLES}  \\
  \end{tabular}
\end{table}
\end{document}

enter image description here

This will also work with colortbl (with the latest version as suggested by David)

\documentclass{report}
\usepackage{colortbl,xcolor}
\begin{document}
\noindent
\begin{table}
  \begin{tabular}{|*9{c|}}
    \rowcolor{gray!30}\multicolumn{8}{ |p{4.0in}|}{ \textbf{ PARTNER } } & textbf{TOTAL PAYABLES}  \\
  \end{tabular}
\end{table}
\end{document}
  • [table]{xcolor} is just telling xcolor to load colortbl so the two versions are the same really. – David Carlisle Sep 11 '13 at 9:19
  • @DavidCarlisle: True. It is doing same thing differently ;-) Thanks . – user11232 Sep 11 '13 at 10:10

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.