# Incomplete row table colors

Quick question regarding colouring rows in a latex table:

I simply want to colour the first row in the following table light gray as in the image. Unfortunately the colour does not seem to fill the full row. I think this has something to do with my specification column separation command "\setlength{\tabcolsep}{0.5cm}".

\documentclass[reprint,amsmath,amssymb,aps,pra,]{revtex4-1}
\usepackage{graphicx}
\usepackage{dcolumn}
\usepackage{bm}
\usepackage{color}
\usepackage{mathrsfs}
\usepackage[table]{xcolor}

\begin{document}
\begin{figure}
\hspace*{0cm}
\setlength{\tabcolsep}{0.5cm}
\begin{table}
\centering
\renewcommand{\arraystretch}{2.0}
\begin{tabular}{|c|c|c|c|c|c|{5cm}}
\hline
\rowcolor[gray]{0.9}
\multicolumn{6}{|c|}{\boldsymbol{\text{Some Text}}}\\
\hline
a & b & c & d & e & f \\
\hline
\end{tabular}
\caption{Example...}
\label{tab:Example}
\end{table}
\end{figure}
\end{document}


Does anyone know how to resolve this? Thanks.

• Please provide the MWE as in error free format... – MadyYuvi Oct 11 '19 at 8:47
• What is {5cm} supposed to do in the list of column specifiers? Probably you wanted something like p{5cm} instead? – leandriis Oct 11 '19 at 8:51
• You have a \boldsymbol outside mathmode. – Bernard Oct 11 '19 at 8:52
• Aslo, \boldsymbol will only work if used in math mode. Nevertheless, \boldsymbol{\text{Some Text}} seems quite unusual. Maybe you wanted \textbf{some text} instead? – leandriis Oct 11 '19 at 8:52
• Please check the post tex.stackexchange.com/questions/294790/… which may suits with your requirement... – MadyYuvi Oct 11 '19 at 8:58

You've modified the value of \tabcolsep inside the figure environment, not in the preamble, so \rowcolor (and \columncolor) overhang is based on the default value. Workaround: use the optional overhang argument.

Unrelated: needless to load color when you load xcolor.

\documentclass[reprint,amsmath,amssymb,aps,pra,]{revtex4-1}
\usepackage{graphicx}
\usepackage{dcolumn}
\usepackage{bm}
\usepackage{mathrsfs}
\usepackage[table]{xcolor}

\begin{document}

\begin{figure}
\hspace*{0cm}
\setlength{\tabcolsep}{0.5cm}
\begin{table}
\centering
\renewcommand{\arraystretch}{2.0}
\begin{tabular}{|c|c|c|c|c|c|p{5cm}}
\hline
\rowcolor[gray]{0.9}[0.5cm]
\multicolumn{6}{|c|}{\textbf{Some Text}}\\
\hline
a & b & c & d & e & f \\
\hline
\end{tabular}
\caption{Example...}
\label{tab:Example}
\end{table}
\end{figure}

\end{document}