I'm trying to fill out cells in several rows of my table, however, the color is not filling the entire cell. I can't explain myself why. Additionally, I want my table to be textwidth
but it's not executed somehow. Maybe someone could help me understand what I'm doing wrong.
All help highly appreciated!
Here is the code:
\begin{table}[]
\centering
\caption{}
\label{Tab1}
\begin{tabularx}{\textwidth}{@{}lccccc@{}}
\toprule
\textbf{Author(s)} & \multicolumn{1}{l}{\textbf{RP}} & \multicolumn{1}{l}{\textbf{PP}} & \multicolumn{1}{l}{\textbf{ST}} & \multicolumn{1}{l}{\textbf{HD}} & \multicolumn{1}{l}{\textbf{RT}} \\ \midrule
AK & Yes & Yes & \cellcolor[HTML]{C0C0C0}\textbf{Yes} & Yes & Yes \\ \midrule
SK & Yes & Yes & \cellcolor[HTML]{C0C0C0}\textbf{Yes} & Yes & Yes \\ \midrule
MN & \cellcolor[HTML]{656565}{\color[HTML]{FFFFFF} No} & {\color[HTML]{333333} Yes} & \cellcolor[HTML]{C0C0C0}\textbf{Yes} & \cellcolor[HTML]{656565}{\color[HTML]{FFFFFF} No} & \cellcolor[HTML]{656565}{\color[HTML]{FFFFFF} No} \\ \midrule
MS & Yes & \cellcolor[HTML]{656565}{\color[HTML]{FFFFFF} No} & \cellcolor[HTML]{C0C0C0}\textbf{Yes} & Yes & \cellcolor[HTML]{656565}{\color[HTML]{FFFFFF} No} \\ \midrule
JB & Yes & Yes & \cellcolor[HTML]{C0C0C0}\textbf{Yes} & Yes & Yes \\ \midrule
HL & Yes & Yes & \cellcolor[HTML]{C0C0C0}\textbf{Yes} & Yes & Yes \\ \bottomrule
\end{tabularx}
\end{table}
This is what I get
Best Answer
You're mixing and (mis)matching two visual metaphors in one table: (a) color, to highlight various cells (and even an entire column) and (b) the well-spaced horizontal lines of the
booktabs
package. Use one or the other metaphor, but not both. In the following screenshot, I show what may be achieved by using just color (or, should I say, scales of gray?).I can't discern a compelling reason for using a
tabularx
environment here; in the code below, I use atabular
environment. If you believe the columns ought to be a bit wider, try adding the instruction\setlength{\tabcolsep}{12pt}
. (The default is6pt
.)