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?



\begin{tabularx}{\textwidth}{ |X|X|X| }
\textbf{Наименование} & \textbf{BBB} & \textbf{ААА} \\ \hline
Теплопостачання припливних систем & 83 044,00 грн. & 67 000 грн \\ \hline
Монтаж , пусканаладка & 64 000,00 грн. & 74885849 грн \\ \hline
ИТОГО: & 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


enter image description here

  • 2
  • 1
    It is possible to hide but I would do what you have, and specify the colour in each cell, not however you should use \textcolor{red}{..........} not \color or you get the spurious extra space above the coloured rows as seen in your image. – David Carlisle Feb 9 '16 at 14:46
  • @Werner, from answer in given link to desired change of text color in row is not so simply as maybe it seems on the first sight. An addendum to it with example how to change colors would be welcome. – Zarko Feb 9 '16 at 15:30

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.