ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: Denis Maier via ntg-context <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: process list items differently depending on position in list
Date: Mon, 2 May 2022 12:33:33 +0200	[thread overview]
Message-ID: <1b7b005a-ee40-d581-aebb-c9697f6d7749@xs4all.nl> (raw)
In-Reply-To: <13fbdf32324b4fcba8f2a08ae0322240@unibe.ch>

On 5/2/2022 12:09 PM, Denis Maier via ntg-context wrote:

> But, it’d still love to hear whether there is a solution on the tex side.
\processtokens {[before]} {[between]} {[after]} {[space]} 
{{one}{two}{three}}

\def\whatever{a,b,c,d}

\getcommacommandsize[\whatever]
\scratchcounterone \zerocount
\scratchcountertwo \commalistsize

\processcommacommand[\whatever]
   {\advance\scratchcounterone\plusone
    \ifnum\scratchcounterone=\scratchcountertwo
      \space and\space
    \orelse\ifnum\scratchcounterone>\plusone
      ,\space
    \fi
    \commalistelement}

but ... there's also:

\startlines
\commalistsentence[aap,noot,mies]
\commalistsentence[aap,noot]
\commalistsentence[aap]
\commalistsentence[a,b,c]
\commalistsentence[a,b,c][{ \& },{ and }]
\commalistsentence[a,b,c][+,-]
\stoplines

which uses presets like

\setuplabeltext [nl] [and-1={{, }}, and-2={{ en }}]   % 1, 2 en 3
\setuplabeltext [en] [and-1={{, }}, and-2={{, }}]     % 1, 2, 3
\setuplabeltext [de] [and-1={{, }}, and-2={{ und }}]  % 1, 2 und 3
\setuplabeltext [hr] [and-1={{, }}, and-2={{ i }}]    % 1, 2 i 3

maybe wikify


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@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
___________________________________________________________________________________

  reply	other threads:[~2022-05-02 10:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02  7:14 Denis Maier via ntg-context
2022-05-02 10:09 ` Denis Maier via ntg-context
2022-05-02 10:33   ` Hans Hagen via ntg-context [this message]
2022-05-02 11:50     ` Denis Maier via ntg-context

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=1b7b005a-ee40-d581-aebb-c9697f6d7749@xs4all.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@xs4all.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).