[Tex/LaTex] How to change font color of a row in tabularx

colortabularx

I have a table and I want a font color of 5th and 6th row be red. What I'm doing right now is changing the color of each cell in these rows, is there any command which can change font color in a row, not just in one cell?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}  
\usepackage{multirow,tabularx}
\usepackage[a4paper,margin=1in,landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{colortbl,hhline}

\begin{document}

\begin{tabularx}{\textwidth}{ |X|X|X| }
\hline
\textbf{Наименование} & \textbf{BBB} & \textbf{ААА} \\ \hline
Теплопостачання припливних систем & 83 044,00 грн. & 67 000 грн \\ \hline
Монтаж , пусканаладка & 64 000,00 грн. & 74885849 грн \\ \hline
\rowcolor{yellow}
ИТОГО: & 1089158,71 грн. & 100000 \\ \hline
\color{red} Отклонение от минимального предложения, грн & \color{red} 0,00 грн. & \color{red} 34000 \\ \hline
\color{red} Отклонение от минимального предложения, \% & \color{red} 0\% & \color{red} 10 \%  \\ \hline
Срок выполнения работ & 3-4 недели & 2 недели \\ \hline
\end{tabularx}
\vspace{1cm}

\end{document}

enter image description here

Best Answer

The following builds on the technique described in An improved \rowstyle that takes the cell contents as an argument, capturing each cell using collcell:

enter image description here

Each cell .. is set using \textcolor{red}{..} depending whether/not the switch \ifrowcolour has been set to \rowcolourtrue or \rowcolourfalse. Since these switches occur inside tabular cells (and therefore groups), they have to be set \globally in order for the change to exist beyond the cell scope.

For visual appeal, I'd suggest using booktabs for you table presentation(s).

Related Question