[NTG-context] Loop?

Jairo A. del Rio jairoadelrio6 at gmail.com
Fri Feb 12 20:48:23 CET 2021


Oh, I knew about the environment form, but I didn't know about
\currentcommalistitem. Useful to avoid to define ad hoc commands :)
As always, thank you very much for the lesson.

Best regards,

Jairo

El vie, 12 de feb. de 2021 a la(s) 14:25, Wolfgang Schuster (
wolfgang.schuster.lists at gmail.com) escribió:

> Jairo A. del Rio schrieb am 12.02.2021 um 19:50:
> > Hi, Ángel. Like this?
> >
> > \def\mylist{Fulano,Mengano,Sutano}
> >
> > \def\mycommand#1{#1\blank{\red Something here}\blank}
> >
> > \starttext
> >
> > \processcommacommand[\mylist]\mycommand
> >
> > \stoptext
> >
> > There are better ways to deal with data in ConTeXt, but it's basically
> > that way, I think.
>
>
> You can use the commalist environment:
>
> \starttext
>
> \startprocesscommalist[One,Two,Three,Four]
>      Person Number \currentcommalistitem\par
> \stopprocesscommalist
>
> \blank
>
> \defineexpandable\NameList{One,Two,Three,Four}
>
> \startprocesscommacommand[\NameList]
>      Person Number \currentcommalistitem\par
> \stopprocesscommacommand
>
> \stoptext
>
>
> Another way is to use the database module:
>
> \usemodule[database]
>
> \starttext
>
> \defineseparatedlist
>    [namelist]
>    [command=\NameEntry]
>
> \starttexdefinition unexpanded NameEntry #1
>      Person Number #1\par
> \stoptexdefinition
>
> \startseparatedlist[namelist]
> One
> Two
> Three
> Four
> \stopseparatedlist
>
> \stoptext
>
>
> Wolfgang
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20210212/4e9bd0b9/attachment-0001.htm>


More information about the ntg-context mailing list