[NTG-context] Loop?

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Sat Feb 13 12:12:47 CET 2021


Angel M Alganza schrieb am 13.02.2021 um 11:42:
> On Fri, Feb 12, 2021 at 02:48:23PM -0500, Jairo A. del Rio wrote:
>> Oh, I knew about the environment form, but I didn't know about
> 
>> El vie, 12 de feb. de 2021 a la(s) 14:25, Wolfgang Schuster (
>> wolfgang.schuster.lists at gmail.com) escribió:
> 
>>> You can use the commalist environment:
> 
>>> Another way is to use the database module:
> 
> Thank you so much, Jairo and Wolfgang.
> All your solutions work fine!
> 
> I had been looking for info on loops and some other ideas for a few days
> already.  I never thought about "lists".   :-)


Below is another version.

Using the \startsetups block to set the content for the loop/list makes 
it easier to strucuture (format) the text. With \recursestring you can 
print the value of the current loop entry.

The list of entries for the loop can be moved from the argument itself 
to a macro. To make adding and removing (can be done by commenting 
entries with %) you can use the \starttexdefinition environment with 
each name on a separate line.

%%%% begin example
\starttext

\startsetups [NameEntry]
     Person Number \recursestring\par
\stopsetups

\doloopoverlist{One,Two,Three,Four}{\directsetup{NameEntry}}

\blank

%\defineexpandable\NameList
%  {One,
%   Two,
%   Three,
%   Four}

\starttexdefinition NameList
     One,
     Two,
     Three,
     Four
\stoptexdefinition

\doloopoverlist{\NameList}{\directsetup{NameEntry}}

\stoptext
%%%% end example

Wolfgang


More information about the ntg-context mailing list