ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mojca Miklavec <mojca.miklavec.lists@gmail.com>
Subject: Re: How to "\processcommalist"?
Date: Fri, 1 Jul 2005 20:45:19 +0200	[thread overview]
Message-ID: <6faad9f005070111458d0e7fd@mail.gmail.com> (raw)
In-Reply-To: <42C5833A.3050204@elvenkind.com>

Taco Hoekwater wrote:
> Mojca Miklavec wrote:
> > I would like to define a command, which would be called in the following way:
> >     \TheBossWantsTheWorkToBeDoneOn[monday,wednesday,thursday]{tidy up}
> >
> > so that it would be equivalent to:
> >     \WeHaveToDo[monday]{tidy up}
> >     \WeHaveToDo[wednesday]{tidy up}
> >     \WeHaveToDo[thursday]{tidy up}
> >
> > I played a bit with different variants of \processcommalist, but I
> > can't figure out how to use it in this particular case.
> 
> The trick is to store the tidy up inside the processing command,
> like so:
> 
>    \def\WeHaveToDo[#1]#2{\message{(#1: #2)}}
> 
>    \def\TheBossWantsTheWorkToBeDoneOn[#1]#2%
>      {\begingroup
>       \def\processitem##1{\WeHaveToDo[##1]{#2}}%
>       \processcommalist[#1]\processitem
>       \endgroup }
> 
>    \TheBossWantsTheWorkToBeDoneOn[monday,wednesday,thursday]{tidy up}

Great, thanks Taco! It works. It seems easier than I thought, but I
could have spent hours looking for the proper solution alone.

I hope this will land in the t-rsteps module (\OnSteps[1,2,3,6]{...}).

> > Is there also a possibility to define a command like
> >     \IHaveToDoTheTasks[1-4,7,9-11]{until tomorrow}
> 
> There was not, but knowing Hans I trust that soon there will be :-).

:)

> For now, here is my solution.
> 
> [...]
>
> With these, you can do:
> 
>    \def\IHaveToDoTheTask[#1]#2{\message{(#1: #2)}}
> 
>    \def\IHaveToDoTheTasks[#1]#2%
>      {\begingroup
>       \def\processitem##1{\IHaveToDoTheTask[##1]{#2}}%
>       \uncompresslist[#1]% <= Yeah!
>       \processcommacommand[\uncompressedlist]\processitem
>       \endgroup }
> 
> I hope you understand what I've done, but otherwise, feel
> free to ask, of course.

Well, my stomach needs some time to process the latter example. But if I write
    \def\IHaveToDoTheTask[#1]#2{\message{(#1: #2)}The task #1 has to
be done #2.\crlf}
    \IHaveToDoTheTasks[1-3]{until tomorrow}
nothing happens.

Thanks again,
    Mojca

  reply	other threads:[~2005-07-01 18:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-01 16:15 Mojca Miklavec
2005-07-01 17:54 ` Taco Hoekwater
2005-07-01 18:45   ` Mojca Miklavec [this message]
2005-07-04 15:12     ` Hans Hagen
2005-07-04 21:08       ` Mojca Miklavec
2005-07-04 22:20         ` Hans Hagen
2005-07-01 20:39   ` How to "\processcommalist"? (corrected solution) Taco Hoekwater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6faad9f005070111458d0e7fd@mail.gmail.com \
    --to=mojca.miklavec.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).