[Tugindia] Dynamic Tables.

David Kastrup dak at gnu.org
Sat Apr 19 19:16:58 CEST 2003


Manoj Kummini <kummini at yahoo.com> writes:

> 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@? 

Try
replacing

  \toks@\expandafter{\the\toks@ \therevlistcnt%
  \tabularnewline}%

with

  \edef\next{\the\toks@ \therevlistcnt}%
  \toks@\expandafter{\next \tabularnewline}


-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
UKTUG FAQ: <URL:http://www.tex.ac.uk/cgi-bin/texfaq2html>


More information about the Tugindia mailing list