[Tex/LaTex] \rowcolor does not paint \multicolumn cells

multicolumnrowcolortablestabularx

Consider the following MWE:

\documentclass{article}
\usepackage{colortbl}
\usepackage{tabularx}
\begin{document}
\begin{table}
\begin{tabularx}{\textwidth}{rX}
Right Right Right & Text \\ 
Right Right Right & Text \\ 
\rowcolor{red}   
\multicolumn{1}{c}{\textbf{Center}} & \\
Right Right Right  &{\small \rule{0pt}{3ex}} Small space \\
\end{tabularx}
\end{table}
\end{document}

For me this displays as enter image description here

How can I make the whole row red instead of just the second-column part of the row, i.e. "Center" should also be red?

(Note: If a solution is very complicated because of the multicolumn (without that it displayes just fine), is there then any other way to make Center be at the center of its cell?)

Best Answer

Like this?

enter image description here

\rowcolor{...} doesn't coloring cells in \multicolumn, so in it you need to additional define cell color with \cellcolor{...}:

\documentclass{article}
\usepackage{colortbl}
\usepackage{tabularx}
\begin{document}
\begin{table}
\begin{tabularx}{\textwidth}{rX}
Right Right Right & Text \\
Right Right Right & Text \\
\rowcolor{red}
\multicolumn{1}{c}{\cellcolor{red}{\textbf{Center}}} & \\ % added cellcolor in multicolum
Right Right Right  &{\small \rule{0pt}{3ex}} Small space \\
\end{tabularx}
\end{table}
\end{document}

Edit: Here something very weird happens. Now I can't reproduce OP's problem, provided MWE works fine without added \cellcolor in \multicoumn cell. Frankly said, now I'm confused about what is going on (see comments below).

Related Question