f



xcolor, \rowcolors and array environments

Is it a bug or a feature? (Or how do I disable alternating row colors
in math mode, while still using them outside?)

\documentclass{article}
\usepackage[table]{xcolor}
\rowcolors{2}{red!50}{blue!50}
\begin{document}
\[ a = \left(\begin{array}{c} 1\\ 2\\ 3 \end{array}\right) \]
\end{document}

Thanks,
Dominik
0
Dominik
9/11/2010 12:42:41 AM
comp.text.tex 38629 articles. 1 followers. Post Follow

3 Replies
1040 Views

Similar Articles

[PageSpeed] 19

Am 11.09.2010 02:42, schrieb Dominik Menke:
> Is it a bug or a feature? (Or how do I disable alternating row colors
> in math mode, while still using them outside?)
> 
> \documentclass{article}
> \usepackage[table]{xcolor}
> \rowcolors{2}{red!50}{blue!50}
> \begin{document}
> \[ a = \left(\begin{array}{c} 
\hiderowcolors
  1\\ 2\\ 3 \end{array}\right) \]
> \end{document}

Herbert
0
Herbert
9/11/2010 10:28:36 AM
On Sep 11, 5:28=A0am, Herbert Voss <Herbert.V...@FU-Berlin.de> wrote:
> Am 11.09.2010 02:42, schrieb Dominik Menke:> Is it a bug or a feature? (O=
r how do I disable alternating row colors
> > in math mode, while still using them outside?)
>
> > \documentclass{article}
> > \usepackage[table]{xcolor}
> > \rowcolors{2}{red!50}{blue!50}
> > \begin{document}
> > \[ a =3D \left(\begin{array}{c}
>
> \hiderowcolors
> =A0 1\\ 2\\ 3 \end{array}\right) \]
>
> > \end{document}
>
> Herbert

That is a little inconvenient when there are a lot of
math alignments. It would be better if xcolor.sty
defined a switch to just turn table colors off for the
rest of the document or current group (and one
to turn them back on, of course). I had some success
with the following. However, I didn't test it very much.

  \makeatletter
    \def\stoprowcolors{\@rowcolorsfalse}
    \def\startrowcolors{\@rowcolorstrue}
  \makeatother
  \everymath{\stoprowcolors}

The problem with \hiderowcolors is that it must occur within
the relevant alignment (its definition starts with \noalign).
A command like \stoprowcolors would be usable elsewhere.

It would also be nice if xcolor.sty could provide a "nomath"
option for row colors.


Dan
0
Dan
9/11/2010 5:54:14 PM
> It would also be nice if xcolor.sty could provide a "nomath"
> option for row colors.

I'd prefer that way too. I also tried to rewrite the \rowcolors
command, by I already failed on the extraction from xolors.sty...

Dominik

0
Dominik
9/14/2010 12:15:13 PM
Reply: