I have a very simple list like this:
cat, fish, dog, rabbit
(this is is comma-separated, but it is fine if the data is stored in some other way, but it needs to allow for any number of items to be added to the list)
I want to store the list somewhere. Then a simple macro, such as \droptext
is placed in the document. The first time it is displayed, it prints "cat", the second time, "fish", etc. The fifth and ninth time it returns to "cat", repeating the loop.
\starttext
\define\mylist{cat, fish, dog, rabbit}
The \droptext\ is a nice animal. So is the \droptext.
Once upon a time, a \droptext\ came to the garden
and ate a \droptext. Everyone was so angry
but then the \droptext came by and brought everyone
a \droptext.
\stoptext
That would print on the page:
The cat is a nice animal. So is the fish.
Once upon a time, a dog came to the garden
and ate a rabbit. Everyone was so angry
but then the cat came by and brought everyone
a fish.
- I tried the
\doloop
command, as from the description seems like it might do this, but the document couldn't even compile when that command was added.
Is there a way to print items from a list, each time a macro appears in the document, iterating through the items, in ConTeXt?