colortbl \rowcolor FOREGROUND color?

  • Follow


I asked this in 2007, but no answer.  I presume this is not possible,
but I will ask briefly---has it become possible to change the
foreground text color with a \rowcolor-like command, too, or is it
still only possible to change the background color (with colortbl's
\rowcolor)?

0
Reply iaw4 2/3/2011 3:15:26 AM

Am 03.02.2011 04:15, schrieb iaw4:
> 
> I asked this in 2007, but no answer.  I presume this is not possible,
> but I will ask briefly---has it become possible to change the
> foreground text color with a \rowcolor-like command, too, or is it
> still only possible to change the background color (with colortbl's
> \rowcolor)?




\documentclass[a4paper]{article}
\usepackage[table]{xcolor}
\usepackage{array}
\begin{document}

\begin{tabular}{>{\columncolor{blue!40}\color{yellow}}c>{\color{red}}c}
 foo & bar \\
\rowcolor{cyan!30} foo & bar
\end{tabular}

\end{document}

Herbert
0
Reply Herbert 2/3/2011 8:09:20 AM


Le 03/02/2011 09:09, Herbert Voss a �crit :
> Am 03.02.2011 04:15, schrieb iaw4:
>>
>> I asked this in 2007, but no answer.  I presume this is not possible,
>> but I will ask briefly---has it become possible to change the
>> foreground text color with a \rowcolor-like command, too, or is it
>> still only possible to change the background color (with colortbl's
>> \rowcolor)?
>
>
>
>
> \documentclass[a4paper]{article}
> \usepackage[table]{xcolor}
> \usepackage{array}
> \begin{document}
>
> \begin{tabular}{>{\columncolor{blue!40}\color{yellow}}c>{\color{red}}c}
>   foo&  bar \\
> \rowcolor{cyan!30} foo&  bar
> \end{tabular}
>
> \end{document}
>
> Herbert

If your columns are not l, c or r (ie p, m or b) then make sure \color
is preceded by \leavevmode, \noindent, \indent or \quitvmode (pdfTeX)...

0
Reply GL 2/3/2011 10:05:25 AM

thanks, herbert.  no, I mean a foreground color for a whole row, not a
foreground color for a column...

/iaw
0
Reply iaw4 2/3/2011 6:21:47 PM

Am 03.02.2011 19:21, schrieb iaw4:
> 
> I mean a foreground color for a whole row, not a
> foreground color for a column...

\documentclass[a4paper]{article}
\usepackage[table]{xcolor}
\usepackage{array}

\newcolumntype{C}{>{\color{\fgcolor}}c}
\newcommand*\setfgcolor[1]{\gdef\fgcolor{#1}}
\setfgcolor{black}

\begin{document}

\begin{tabular}{>{\columncolor{blue!40}}CCC}
 foo & bar & baz\setfgcolor{red}\\
 foo & bar & baz\setfgcolor{black}\\
 foo & bar & baz\\
\end{tabular}

\end{document}

must be set _before_ the foregoing row ends

Herbert
0
Reply Herbert 2/3/2011 7:21:37 PM

thank you, herbert.  duh!  great use of the '>' command with gdef.
0
Reply iaw4 2/4/2011 12:44:47 AM

5 Replies
199 Views

(page loaded in 0.205 seconds)

Similiar Articles:

7/20/2012 4:00:04 PM


Reply: