TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found the following post to change the font color of a single row in a table:

How to color the font of a single row in a table?

My row is a long table with 70 rows and for about 25 the I want to change the font color. I was wondering if there is a better way of coloring these 25 rows rather than using \rowfont{\color{red}} 25 times?

share|improve this question
up vote 4 down vote accepted

enter image description here

\documentclass{article}

\usepackage{color,array}

\makeatletter


\def\zapcolorreset{\let\reset@color\relax\ignorespaces}
\def\colorrows#1{\noalign{\aftergroup\zapcolorreset#1}\ignorespaces}

\makeatother

\begin{document}

\begin{tabular}{ll}
1&2\\
1&2\\
1&2\\\colorrows{\color{red}}
1&2\\
1&2\\
1&2\\\colorrows{\color{black}}
1&2\\
1&2\\
1&2
\end{tabular}
\end{document}
share|improve this answer
    
Create solution! thanks! – Josh Feb 6 '13 at 12:05
    
Doesn't this need something like \edef\endtabular{\unexpanded\expandafter{\endtabular}\noexpand\reset@color} as well to ensure that the colour stops at the end of the table (if not manually reset)? – Joseph Wright Jan 26 at 18:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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