[NTG-context] Loop?

Jairo A. del Rio jairoadelrio6 at gmail.com
Fri Feb 12 19:50:58 CET 2021


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.

Jairo



El vie, 12 de feb. de 2021 a la(s) 13:44, Angel M Alganza (ama at ugr.es)
escribió:

> Hello:
>
> I am trying to print a list of names always followed by the same info
> (generated by a new command).  At the moment, I have all the names
> followed by the command like so:
>
>         Person Number One
>         \mycommand
>         Person Number Two
>         \mycommand
>         Person Number Three
>         \mycommand
>         Person Number Four
>         \mycommand
>         Person Number Five
>         \mycommand
>         .
>         .
>         .
>
> I'd rather have the list of people stored somewhere (a list? an array?)
> and loop through it and then inserting \mynewcommand at compilation
> time.  That way, when I need to replace the list of people with a new
> one, I'd just do that instead of building the above structure again and
> again.
>
> Is it possible to do that with just ConTeXt or would I need to resort to
> Lua.  I guess it should be possible both ways, but I haven't figure out
> how to do it.  Any pointer, please?
>
> Thank you so much in advance.
>
> Cheers,
> Ángel
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context at ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20210212/c8e1bf4a/attachment.htm>


More information about the ntg-context mailing list