COMPGROUPS.NET | Post | Groups | Users | Stream | Browse | About | |

### xcolor, \rowcolors and array environments

• Email
• Follow

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

See related articles to this posting

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

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

> 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
 comp.text.tex 36450 articles. 68 followers.

3 Replies
808 Views

Similar Articles

[PageSpeed] 8

• Email
• Follow

Similar Artilces:

arrows in an array environment
This may be a somewhat frequently asked question, but I've done web searches and I'm stumped, not to mention frustrated by my own attempts. I am starting with an array (or tabular) environment, with horizontal and vertical lines separating the cells: _______ |a|b|c| _______ |x|y|z| _______ I want to include an arrow, say from y to a. How should I do this? I'm trying xypic, but I find the manual incredibly frustrating. Here's what I have: \xy \begin{array}{|c|c|c|} \hline \xymatrix"*"{a} & b & c \\ \hline x & \xymatrix{y \ar@{-}["*&qu... \raisebox in array environment Hello, I'm trying to use raisebox in an array environment. However it seems to have no effect on the text - it simply stays on the same line even though it should be one line raised. The TeX source I use is the following: \documentclass{article} \begin{document} \begin{array}{ll} \raisebox{\baselineskip}[0pt]{a} b & c d \\ e f & g h \end{array} \end{document} When I put \raisebox outside the array environment it raises given text as it should. Could you please help me - how can i get the text in \raisebox really raised? --Hynek Hynek Mlnarik <xmlnarik@fi.muni.c... php environment array Hello, I don't know that much about php but I was asked this question : we have a testbox running Linux, Apache-1-3-29 and PHP/4.3.4 echo "<b>ENV</b><br>"; foreach(_ENV as Name1=>Key1) { echo Name1." is: ".Key1."<br>"; } when this is executed it says somewhere that the logname is root. However the apache server is running under the uid apache and group apache. I suspected that when this is executed it would say that the logname is apache or am I wrong assuming that ? thanks, Ron Ron Croonenberg wrote: > we hav... Odd interaction with xcolor and environment If I TeX the minimal example (below) as-is, I get this error: ) ! Missing } inserted. <inserted text> } l.22 \begin{myboxit} If I comment-out \usepackage{xcolor}, the file TeXs without a problem. I'm using TeXLive 2010. What am I doing wrong? Stephen Moye %%==8><--%% \documentclass{article} \usepackage{xcolor} \newsavebox{\snugbox} \newenvironment{myboxit}{% \sbox{\snugbox}\bgroup }% {% \egroup \begin{center} \fbox{\usebox{\snugbox}} \end{center} } %%====8><----%% \begin{document} Suspendisse vestibulum dig... AWK : Shell Arrays / ENVIRON Hello It is possible to use environment shell arrays in AWK through the ENVIRON AWK associative array? For normal shell variables this is no problem. # export a=1 # echo test | awk '{print ENVIRON["a"]}' 1 However what about shell arrays? # set -A testarray 1 2 3 4 # export testarray # set | grep testarray testarray[0]=1 testarray[1]=2 testarray[2]=3 testarray[3]=4 # echo test | awk '{print ENVIRON["testarray[0]"]}' <-- no go # echo test | awk '{print ENVIRON["testarray"]}' <-- this works and gives the first element of the ar... matrix within an array environment The following code does not work \begin{equation*} \begin{array}{ccl} m_0 & = & \begin{pmatrix} Y_1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \end{pmatrix} \\ C_0 & = & 1 \\ V & = & 1 \\ \end{array} \end{equation*} because I get this error message: ----------------- ! Extra alignment tab has been changed to \cr. <recently read> \endtemplate l.175 ...& 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0... arrows in an array environment #2 This may be a somewhat frequently asked question, but I've done web searches and I'm stumped, not to mention frustrated by my own attempts. I am starting with an array (or tabular) environment, with horizontal and vertical lines separating the cells: _______ |a|b|c| _______ |x|y|z| _______ I want to include an arrow, say from y to a. How should I do this? I'm trying xypic, but I find the manual incredibly frustrating. Here's what I have: \[ \xy \begin{array}{|c|c|c|} \hline \xymatrix"*"{a} & b & c \\ % try to create a matrix called * \hline ... Line numbers on array like environments Hi, I am interested in including line numbers in array-like or math mode-like environments, say \begin{array}\end{array} or \[. The idea is to have the line numbers on long formulas such that it is easier for one to describe the formula by referencing to sections (lines) in the formula. For example, in a code such as $x := 10 ; \\ while (x > 0) do \{ \\ \quad printmessage ; \\ \quad x := x - 1 ; \\ \}$ I would like to have in the DVI file something like 1 x := 10 2 while (x > 0) do { 3 printmessage ; 4 x := x - 1 ; 5 } Is there any easy way (i.e. an available package ...

Problem with array environment inside caption
Input : \begin{figure} \scalebox{0.7}[0.7]{\includegraphics{figures/v.png}} \caption{A schematic. $V_{C} \sim \left\{\begin{array}{cc} E_{g} & \textrm{p-n} \\ e\phi_{B} & \textrm{M-S}\end{array}\right.$ } \label{fig:v} \end{figure} Error (upon pdflatex) : <figures/v.png, id=1479, 217.71338pt x 217.71338pt> <use figures/v.png> ! Argument of \@caption has an extra }. <inserted text> \par l.12 ...d{array}\right. \]} ? I found : http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/2476& But I am using '\\' instead of \newline...

Problem with array environment and ifnum tests
Dear all, I am struggling with the following piece of code: \documentclass[a4paper]{article} \usepackage{keyval} \makeatletter \def\test@val{0} \newcommand{\test}[2][]{% \setkeys{testkeys}{#1}arg2 = #2, we~have~\test@val, \ifnum\test@val=2% tux is 2 \fi% we~have~\test@val, \ifnum\test@val=1% \\ % \test@val set to zero here!!! \fi% we~have~\test@val } \define@key{testkeys}{tux}{\def\test@val{#1}} \makeatother \begin{document} \begin{math} \begin{array}{ll} \test[tux=1]{2} \end{array} \end{math} \end{document} All I want to achieve is for \test to output \\ (within ...

Equal column widths in array environment
Hi all, Is there an *easy* (logical?) way of obtaining equal column widths in an array environment? This problem has been solved in a tabular environment, and there are numerous solutions. I'm looking for a solution in the following by any way of the following, if possible: [1] defining a new column type (that works in math mode) for columns that should be the same width (like p{..} for tabular); or [2] defining a new environment altogether, similar to array that works in math mode The above may be achieved either if the largest column width is known, or better, if it is not. One sol...

table with double entries using \rowcolors from xcolor
I want to build a table where each row holds double entries (pairs [a1,a2]; [b1,b2]; etc.) that are vertically placed, like this: ---------------- | a1 | b1 | c1 | | a2 | b2 | c2 | |--------------| | d1 | e1 | f1 | | d2 | e2 | f2 | |--------------| | g1 | h1 | i1 | | g2 | h2 | i2 | ---------------- I could split an entry on two different rows in order to obtain such a table: \hline a1 & b1 & c1 \\ a2 & b2 & c2 \\ ... but this is not convenient because I want to keep handling pairs and not just one element of a pair. I could also use the \multirow command but this i...

again
Hello, again we struggled over a problem with the env array and the existence of env array elements (environment variables). Simplyfied we did following: % set env(foo) 1 1 % info exists env(foo) 1 % set env(foo) "" % info exists env(foo) 1 % set env(foo) can't read "env(foo)": no such variable % llength [array get names foo] 0 So - not remembering that on MS Windows setting an empty string deletes an environment variable, and thinking that setting tcl array element with an empty string won't delete that element, cause...

how do I access ksh environment array variables in perl?
hello, in ksh you can set array variables like a[1]=x a[4]=y and access them like echo ${a[1]} how do I access this array in Perl?$ENV{"a"} retrieves 'x' (the value of a[1]) keys %ENV lists 'a' amongst its vars but how do I find out that a is an array, the length of a and its subscripts and values? rgds andy Andy Haupt wrote: > hello, > > in ksh you can set array variables like > a[1]=x > a[4]=y > and access them like > echo ${a[1]} > > how do I access this array in Perl? You don't. Array variables are Korn Shell specifi... Questions about how the "array" environment is implemented.... I'm currently working on a reimplementation of the LaTeX array environment for ConTeXt, and I have a couple of questions about why certain things were done the way they're done in the original. First, the LaTeX array code sets \@arstrut's strut in a box and then recalls that box each time the strut is needed, rather than putting the strut in an \edef'ed macro. What's the advantage to this? (It seems to me a disadvantage, as it means that arrays of different arraystretch cannot be nested.) Second, all of the preamble creation code works by redefining a macro, with... "Undefined control sequence" I've checked the archives and Googled for this to no avail. I get an "undefined control sequence" error when using the \rowcolors command from xcolor. The example below is from the xcolor documentation. I'm using MiKTeX 2.5 and version 2.09 of xcolor. What's my problem? Thanks \documentclass{article} \usepackage{xcolor} \begin{document} \rowcolors[\hline]{3}{green!25}{yellow!50} \arrayrulecolor{red!75!gray} \begin{tabular}{ll} test & row \number\rownum\\ test & row \number\rownum\\ test & row \number\rownum\\ test & row \number\rownum\\ \arrayrulec... xcolor's \rowcolors extends beyond table borders Hi, I'm trying to fancy up my tables a bit by adding color and I've run into a snag. If I use the standard \rowcolors command, the result is that the color extends outside my black ruled borders. I know the reason - my "borders" are not really border but rules in a column in which I've suppressed the intercolumn spacing with @{}. I can't see a way to get both colors and vertical border rules. Suggestions would be welcomed. Here's a short LaTeX source file illustrating the problem: \documentclass[10pt]{article} \usepackage{colortbl} \usepackage{xcolor} % ... Can I *{num}{cols} within main body of an array environment? Hi, \begin{array}[pos]{|*{5}{|c|}} & & & & & \\ \end{array} allows me to specify |c| columns 5 times. My questions is can I repeat the data to go into the columns in the same way? Thus \begin{array}[pos]{|*{5}{|c|}} something1 & *{4}{& something2} \\ \end{array} David R David R wrote: > Hi, > \begin{array}[pos]{|*{5}{|c|}} > & & & & & \\ > \end{array} > > allows me to specify |c| columns 5 times. > My questions is can I repeat the data to go into the columns in the same > way? Thus > \begin{array}[pos]{|*{5}{|c|... SN#10785 Sun StorEdge[TM] 3310 SCSI Array Handles the Toughest Environments SYSTEM NEWS FOR SUN USERS Vol 66 Issue 3 2003-08-18 Article 10785 from section "Storage" Optimized for Sun's Low-cost Computing Servers Demanding workplace environments require an easy-to-use, simple-to-manage, highly flexible storage array platform. The versatile Sun StorEdge[TM] 3310 SCSI array is a low-profile, ultra-condensed, modular storage array designed for the diverse needs of fast-growing environments. It includes many enterprise-class features and functions such as remote management service. B... show array of array of array of array... I'm trying to print an array of (datas and array of (datas and array of (datas and array..... Here is the code: ... Re: show array of array of array of array... sorry..the code: function printtree($array, $level){ while(list($k,$v) = each($array)) if(is_array($k)){ print("$k -><br>"); printtree($k,$level++); } else { for($i=0;$i<$level;$i++) print("&nbsp;"); print("$k :$v<br>"); } } but it does only print the first level and get out !!! I can't figure what's wrong.... Please help !!!! BoB Bob Bedford wrote: > sorry..the code: > > function printtree($array,$level){ > while(list($k,$v) = each($array)) > if(is_array($k)){ > print(&quo...

const and array of array (of array ...)
Imagine I have an array of arrays of ints and want to sum all the ints. #include <stdio.h> int sumints(int arr[3][3]) { int c, r, s=0; for (r=0; r<3; r++) { for (c=0; c<3; c++) { s += arr[r][c]; } } return s; } int main(void) { int my_array[3][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}}; printf("sum of ints is %d\n", sumints(my_array)); return 0; } I tried to define the su...

Arrays Of Arrays: Is it an Array or Scalar?
I have a function that I'm using to perform operations on strings in an array. There are times where I'd like to have this function work on arrays of arrays. Is there a simple way to tell if the value of an element in an array is a scalar, or is, instead, a reference to another array? I know I can use a regex to see if the string matches the pattern for an array reference, but is there a more "elegant" and easier way to do it? (And, while I'm at it, is there a way to check for a hash as well? I'd think they'd both be done the same way.) Thanks! Hal In <...

convert array to array-of-arrays?
Rubies: Given [1, 2, 3, 4], what's the most Rubiesque way to get [[1, 2], [3, 4]]? I had figured a variation on Array#transpose would be available, but I can't find one! -- Phlip On Feb 4, 10:45 am, Phlip <phlip2...@gmail.com> wrote: > Rubies: > > Given [1, 2, 3, 4], what's the most Rubiesque way to get [[1, 2], [3, 4]]? > > I had figured a variation on Array#transpose would be available, but I can't > find one! > > -- > Phlip have a look at enum.partition (http://ruby-doc.org/core/classes/ Enumerable.html#M003161) cheers Chris Hu...