[texhax] Handling arrays or lists in LaTeX command arguments

Uwe Lueck uwe.lueck at web.de
Thu Apr 22 09:53:33 CEST 2010


Brandon Kuczenski <brandon at 301south.net> 22.04.2010 01:49:37:
> I'm hunting for a TeX or LaTeX macro which processes an argument as a 
> [c-style] array with a (possibly arbitrary, possibly fixed) number of entries.

    http://ctan.org/pkg/arrayjob

? HTH -- Uwe.

-----Ursprüngliche Nachricht-----
Von: Brandon Kuczenski <brandon at 301south.net>
Gesendet: 22.04.2010 01:49:37
An: texhax at tug.org
Betreff: [texhax] Handling arrays or lists in LaTeX command arguments

>Hi TeXers,
>
>I'm hunting for a TeX or LaTeX macro which processes an argument as a 
>[c-style] array with a (possibly arbitrary, possibly fixed) number of 
>entries.
>
>For instance, I imagine three hypothetical LaTeX commands:
>
>\defarray{\arrayname}{num}{[element1,element2,element3...]}
>
>creates an array called \arrayname with num elements.  Here I assume the 
>elements are comma-separated and enclosed in brackets, but that is just 
>for example.
>
>\arraydo{\arrayname}{operation}
>
>performs 'operation' once for each element in the array in succession.
>
>\thearrayelement
>
>(within \arraydo) expands to the current element in the array.
>
>Is such a thing remotely possible?  Anything that points in this 
>direction would be appreciated.  The ability to index into the array 
>would be extra-special.
>
>
>
>%%-----------------------
>%% code sample
>
>\newcommand{\boxnumbers}[1]{ %
>   \arraydo{#1}{% hypothetical array expander
>	\fbox{\thearrayelement}\;%
>	} %
>}
>
>% The Sequence
>\defarray{\foo}{6}{[4,8,15,16,23,42]} % hypothetical array constructor
>
>\boxnumbers{\foo}
>
>%% end code sample
>%%-----------------------
>
>would create a series of boxes, each containing a number from The Sequence.
>
>thanks for any pointers,
>Brandon
>
>--
>
>_______________________________________________
>TeX FAQ: http://www.tex.ac.uk/faq
>Mailing list archives: http://tug.org/pipermail/texhax/
>More links: http://tug.org/begin.html
>
>Automated subscription management: http://tug.org/mailman/listinfo/texhax
>Human mailing list managers: postmaster at tug.org



More information about the texhax mailing list