7

I want to add different background colors of the rows of table for better readability. My (not jet minimal working) example is the following:

\documentclass{article}
\usepackage{amssymb,pifont,booktabs,caption,fixltx2e}
\usepackage[flushleft]{threeparttable}

\usepackage{multirow}

\begin{document} 
%\begin{landscape}
\begin{table}[htbp]
\begin{threeparttable}
\centering
\caption{Open Market Operations }
\begin{tabular}{p{3cm} p{3cm}cccccccc}
\hline
&                      & \textbf{A} & \textbf{B} & \textbf{Bh} & \textbf{I} & \textbf{Ma} & \textbf{Ne} & \textbf{Pa} & \textbf{S} \\
\hline

\multirow{5}{3cm} {\textbf{Frequency}} 
& Once a day           & \ding{55} & \ding{51} & \ding{55} & \ding{51} & \ding{55} & \ding{55} & \ding{55} & \ding{55} \\
& More than once a day & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{51} \\
& Weekly               & \ding{55} & \ding{51} & \ding{55} & \ding{51} & \ding{51} & \ding{51} & \ding{51} & \ding{55} \\
& Fortnightly          & \ding{51} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} \\
& Others               & \ding{55} & \ding{55} & \ding{51} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} \\
\hline

\multirow{4}{3cm} {\textbf{Tenor}}     
& Overnight            & \ding{51} & \ding{51} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{51} \\
& 2-7 days             & \ding{55} & \ding{51} & \ding{55} & \ding{51} & \ding{51} & \ding{55} & \ding{51} & \ding{51} \\
& 8-14 days            & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{51} \\
& More than 14 days    & \ding{55} & \ding{51} & \ding{51} & \ding{55} & \ding{55} & \ding{51} & \ding{55} & \ding{51} \\
\hline

\multirow{2}{3cm} {\textbf{Eligible Assets for Collateral} }
& Government securities& \ding{55} & \ding{51} & \ding{51} & \ding{51} & \ding{51} & \ding{51} & \ding{51} & \ding{51} \\
& Central bank bills   & \ding{51} & \ding{51} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{51} \\
\hline

\multirow{3}{3cm} {\textbf{Nature of Transaction}} 
& Outright             & \ding{51} & \ding{55} & \ding{55} & \ding{51} & \ding{55} & \ding{51} & \ding{51} & \ding{51} \\
& Repo                 & \ding{55} & \ding{51} & \ding{55} & \ding{51} & \ding{51} & \ding{51} & \ding{51} & \ding{51} \\
& Other                & \ding{55} & \ding{51} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} & \ding{55} \\
\hline

\multirow{2}{3cm} {\textbf{Interest Rate Determination}}
& Auction              & \ding{51} & \ding{51} & \ding{51} & \ding{51} & \ding{51} & \ding{51} & \ding{51} & \ding{51} \\
& Fixed rate           & \ding{55} & \ding{55} & \ding{55} & \ding{51} & \ding{55} & \ding{55} & \ding{55} & \ding{55} \\
\hline
\end{tabular}

\begin{tablenotes}
\small
\item Source: 
\item 1 OMOs through.
\item 2 Daily and weekly Liquidity Adjustment Facility.
\item 3 91 days
\item 4 By way of secondary market transactions
\item A: S
\end{tablenotes}

\end{threeparttable}
\label{tab:addlabel}
\end{table}
\end{document}
Ahmad
  • 479

1 Answers1

6

I'm not sure about your question. Is something like this what you want?

Colored table entries

\documentclass{article}
\usepackage{amssymb,pifont,booktabs,caption,fixltx2e}
\usepackage[flushleft]{threeparttable}
\usepackage{xcolor}

\usepackage{multirow}

\newcommand{\ok}  {\textcolor{green}{\ding{51}}}
\newcommand{\fail}{\textcolor{red}  {\ding{55}}}

\begin{document} 

%\ok{} \fail{}

\begin{table}[htbp]
\begin{threeparttable}
\centering
\caption{Open Market Operations }
\begin{tabular}{p{3cm}p{3.5cm}cccccccc}
\hline
&                      & \textbf{A} & \textbf{B} & \textbf{Bh} & \textbf{I} & \textbf{Ma} & \textbf{Ne} & \textbf{Pa} & \textbf{S} \\
\hline

\multirow{5}{3cm} {\textbf{Frequency}} 
& Once a day           &\fail&\ok  &\fail&\ok  &\fail&\fail&\fail&\fail \\
& More than once a day &\fail&\fail&\fail&\fail&\fail&\fail&\fail&\ok   \\
& Weekly               &\fail&\ok  &\fail&\ok  &\ok  &\ok  &\ok  &\fail \\
& Fortnightly          &\ok  &\fail&\fail&\fail&\fail&\fail&\fail&\fail \\
& Others               &\fail&\fail&\ok  &\fail&\fail&\fail&\fail&\fail \\
\hline

\multirow{4}{3cm} {\textbf{Tenor}}     
& Overnight            &\ok  &\ok  &\fail&\fail&\fail&\fail&\fail&\ok   \\
& 2-7 days             &\fail&\ok  &\fail&\ok  &\ok  &\fail&\ok  &\ok   \\
& 8-14 days            &\fail&\fail&\fail&\fail&\fail&\fail&\fail&\ok   \\
& More than 14 days    &\fail&\ok  &\ok  &\fail&\fail&\ok  &\fail&\ok   \\
\hline

\multirow{2}{3cm} {\textbf{Eligible Assets for Collateral} }
& Government securities&\fail&\ok  &\ok  &\ok  &\ok  &\ok  &\ok  &\ok  \\
& Central bank bills   &\ok  &\ok  &\fail&\fail&\fail&\fail&\fail&\ok  \\
\hline

\multirow{3}{3cm} {\textbf{Nature of Transaction}} 
& Outright             &\ok  &\fail&\fail&\ok  &\fail&\ok  &\ok  &\ok  \\
& Repo                 &\fail&\ok  &\fail&\ok  &\ok  &\ok  &\ok  &\ok  \\
& Other                &\fail&\ok  &\fail&\fail&\fail&\fail&\fail&\fail\\
\hline

\multirow{2}{3cm} {\textbf{Interest Rate Determination}}
& Auction              &\ok  &\ok  &\ok  &\ok  &\ok  &\ok  &\ok  &\ok  \\
& Fixed rate           &\fail&\fail&\fail&\ok  &\fail&\fail&\fail&\fail\\
\hline
\end{tabular}

\begin{tablenotes}
\small
\item Source: 
\item 1 OMOs through.
\item 2 Daily and weekly Liquidity Adjustment Facility.
\item 3 91 days
\item 4 By way of secondary market transactions
\item A: S
\end{tablenotes}

\end{threeparttable}
\label{tab:addlabel}
\end{table}
\end{document}
strpeter
  • 5,215
Ignasi
  • 136,588
  • I like your answer, @ignasi So Great!! Beautifull table!!! And too, the original in B/W – Mika Ike Apr 29 '14 at 08:14
  • Thank you for your response, it's work well, i am using scalebox for resizing the tabular, but its not working. – Ahmad Apr 29 '14 at 09:39
  • 1
    @Ahmad. "It's not working" doesn't provide too much information, but if you need to resize your table I'd suggest using \resizebox command (from graphicx package) or a tabularx instead of tabular to lay your table. You'll find several examples in TeX.SX. – Ignasi Apr 29 '14 at 10:01
  • i want to add background color. one color for frequncy, other color for tenor,....., another color for interest rate determinations and for footnote also. – Ahmad Apr 30 '14 at 16:40
  • Ignasi, I think @Ahmad is asking for a way to color the background of an entire row in his table. I think this is a duplicate question. coloring entire row of tabular* certainly provides an answer to what I'm suggesting. – corporal May 01 '14 at 05:15