I want to color the top row of my table. However, when I used the \rowcolor command, there are white spaces appearing in the second and third columns (cell is not filling completely with the color). How can I solve this? I am facing this problem over multiple tables. Is it because of a clash between some packages or something else?
\documentclass[11pt,a4paper,twoside,openrights,hidelinks]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{multirow}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{makecell}
\usepackage{tabu}
\usepackage{threeparttablex}
\usepackage{hhline}
\usepackage[RGYK]{xcolor}
\usepackage{colortbl}
\begin{document}
\begin{table}[t!]
\renewcommand{\arraystretch}{1.3}
\centering
\scriptsize
\caption{Feeder energy losses for 10 days before and after phase switching of the loads for both phase switching algorithms.}
\begin{threeparttable}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\rowcolor{gray!50} \textbf{Feeder} & \multicolumn{3}{c|}{\thead{\thead{\textbf{Losses for} \textbf{Passive Network} \\ \textbf{(Scenario S1)}} \\ $[\textbf{kWh}]$}}& \multicolumn{3}{c|}{\thead{\thead{\textbf{Losses for} \textbf{Active Network} \\ \textbf{(Scenario S2)}} \\ $[\textbf{kWh}]$}}\\
\hline
& \textbf{BC} & \textbf{PSA-1} & \textbf{PSA-2} & \textbf{BC} & \textbf{PSA-1} & \textbf{PSA-2} \\ \hline
\textit{Feeder 1} &38.3 &30.7 (-19.8\%) &37.0 (-3.4\%) &38.3 &30.7 (-19.8\%) &37.0 (-3.4\%)\\ \hline
\textit{Feeder 2} &73.2 &53.2 (-27.5\%) &65.0 (-11.2\%) &71.1 &49.7 (-30.1\%) &61.1 (-14.1\%)\\ \hline
\textit{Feeder} 3 &493.6 &278.1 (-43.6\%) &339.1 (-31.3\%) &487.0 &266.5 (-45.3\%) &332.0 (-31.8\%)\\ \hline
\textit{Network} &605.1 &362.0 (-40.2\%) &441.1 (-27.1\%) &596.4 &346.9 (-41.8\%) &430.1 (-27.8\%)\\ \hline
% \end{tabularx}
\end{tabular}
\end{threeparttable}
\begin{tablenotes}\footnotesize
\item BC: Base Case
\end{tablenotes}
\label{chp4_Table1}
\end{table}
\end{document}
thead
. Is usingtabularx
an option?