[Tuglist] colortbl
somendra bhattacharjee
tuglist@tug.org.in
Fri, 10 May 2002 04:14:20 -0700 (PDT)
Hello,
I am trying to use the rowno counter (suggested in
this list) to generate periodic sequence of row
colours.
The simplest case is one colour for odd rows and
another for even.
A modification of the rowno example (given below) when
latex'ed with scrollmode seems to give an OK ps file.
However, there is _one_ error message _per_ row of
the
table (coming from the ifthenelse loop).
What is going wrong here? Or is there a better way of
doing this automatic row colour.
With thanks
somen bhattacharjee
***** example *****
%%%%%%%%%
\documentclass{article}
\usepackage{ifthen}
\usepackage{colortbl}
\newcounter{rowno}
\setcounter{rowno}{0}
\newcommand{\rlno}{\addtocounter{rowno}{1}\rwcrl}
\newcommand{\rcl}{\rowcolor{yellow}}
\newcommand{\rrl}{\rowcolor{red}}
\newcommand{\rwcrl}{%
\ifthenelse{\isodd{\value{rowno}}}{\rcl}{\rrl}%
}
\begin{document}
\begin{tabular}{!{\rlno}|c|c|c|}
\hline
the & first & row\\
\hline
the & second & row\\
\hline
the & third & row\\
\hline
\end{tabular}
\end{document}
%%%%%%%%%%%%%%%
__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com