[Tugindia] Dynamic Tables.

Manoj Kummini kummini at yahoo.com
Sat Apr 19 14:58:57 CEST 2003


I am trying to create a dynamic table with the following code:
\begingroup
\toks@{}\toks@\expandafter{\the\toks@ \begin{tabular}{|c|}}
\loop\ifnum\c at revlistcnt<\c at revcnt
\stepcounter{revlistcnt}%
\toks@\expandafter{\the\toks@ \therevlistcnt%
\tabularnewline}%
\repeat
\typeout{\the\toks@}
\toks@\expandafter{\the\toks@ \end{tabular}}
\the\toks@
\endgroup

The output of \typeout{} is 
\begin {tabular}{|c|}\therevlistcnt \tabularnewline \therevlistcnt
\tabularnewline \end {tabular}

How does one get \therevlistcnt expanded and added to \toks@? 
The counter revcnt has value 2, and the DVI file contains a table of
two rows, both containing 2. I tried a `dirty' technique to get
around this with
\begingroup
\toks@{}\toks@\expandafter{\the\toks@ \begin{tabular}{|c|}}
\loop\ifnum\c at revlistcnt<\c at revcnt
\stepcounter{revlistcnt}%
\toks@\expandafter{\the\toks@\stepcounter{revlistcnt}\therevlistcnt%
\tabularnewline}%
\repeat
\setcounter{revlistcnt}{0}
\toks@\expandafter{\the\toks@ \end{tabular}}
\typeout{\the\toks@}
\the\toks@
\endgroup
This one works, but is really ugly. Is there any other way out?

Manoj.

=====
--
Manoj Kummini
http://www.geocities.com/kummini/index.html
12 deg 58 min N, 77 deg 35 min E

________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
       visit http://in.tv.yahoo.com


More information about the Tugindia mailing list