[texhax] sub array within tables

debian debian at benburb.demon.co.uk
Thu Sep 6 21:53:28 CEST 2007


Please,

I am trying to pass data to a predefined table, so that I can say
"here table, is an array of data, processs it for me.  Thanks."

Pseudo code:

\newcommand{\mytable}{
  \begin{tabular}{ll}		% or maybe something more complex
     for (\i=o;i <= \mylimit;i++) {
       \mydata[i] & \myotherdata[i]  \\
     }
  \end{tabular}
}     

\newcommand{\mydata[1]}{doh}	% an array of data
\newcommand{\mydata[2]}{ray}
\newcommand{\mydata[3]}{me}
.....
.....
\newcommand{\mydata[20]}{snark}
\newcommand{\mylimit}{20}

\newcommand{\myotherdata[1]}{uncle} % another array
....
\newcommand{\myotherdata[20]{all}

\mytable{\mydata}

I find myself needing to do this sort of thing - reusing tables.
Actually, they are more like forms than tables.

Perhaps I am just being lazy, or daft.  Or, perhaps it would be better
to use Perl than Latex ?

Thanks.

Joe



More information about the texhax mailing list