From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: [NTG-context] Re: Using \commalistsentence in combination with \processcommacommand... I'm going mad?
Date: Wed, 17 Sep 2025 09:28:50 +0200 [thread overview]
Message-ID: <e42c4f4e-a7cc-47e4-ab97-5555beb72ac8@xs4all.nl> (raw)
In-Reply-To: <CAGhDZhBtphi8UBOY3Oz+7XdoJZO2PHf-s+PMrkS=VeL964MPmw@mail.gmail.com>
On 9/17/2025 6:18 AM, Andres Conrado Montoya wrote:
> \definenamespace[autores][
> type=module,
> name=autor,
> command=yes,
> parent=autores,
> ]
>
> \define[1]\AutorNombreApellido{\edef\currentautor{#1}{%
> \doifsomething{\autorparameter{nombres}}{\autorparameter{nombres}\space}%
> \doifsomething{\autorparameter{apellidos}}{\autorparameter{apellidos},}%
> }}
>
> \define[1]\ListaAutores{{\AutorNombreApellido{#1}}\space}
> \define\autoresListaH{\processcommacommand[\documentvariable{autores}]\ListaAutores}
>
> \defineautor[autores][rol={autor}]
> \defineautor[andi][autores][nombres={Andrés Conrado}, apellidos={Montoya
> Acosta}]
> \defineautor[soni][autores][nombres={Sonia Amparo}, apellidos={Rodríguez
> Rodríguez}]
> \defineautor[sofi][autores][nombres={Sofía}, apellidos={Parra Albarracín}]
>
> \startdocument[autores={andi,soni,sofi}]
>
> \commalistsentence[\documentvariable{autores}][{;\space},
> {\space\letterampersand\space}]
>
> \blank[big]
>
> \commalistsentence[\autoresListaH][{;\space},{\space\letterampersand\space}]
>
> \stopdocument
Take your choice ... two approached, one a bit mkii-ish, the other more
lmtx-ish (both ok, all depends on specific needs)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\starttexdefinition AutorNombreApellido #1
\edef\currentautor{#1}%
\doifsomething {\autorparameter{nombres}} {
\autorparameter{nombres}
\space
}
\doifsomething {\autorparameter{apellidos}} {
\autorparameter{apellidos}
}
\stoptexdefinition
% \starttexdefinition AutorNombreApellido #1
% \edef\currentautor{#1}%
% \unless \ifempty {\autorparameter{nombres}}
% \autorparameter{nombres}
% \space
% \fi
% \unless \ifempty {\autorparameter{apellidos}}
% \autorparameter{apellidos}
% \fi
% \stoptexdefinition
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\starttexdefinition AutorWhatever #1
\scratchcounterone\zerocount
\scratchcountertwo\zerocount
\doloopovermatch {(\letterpercent w+)} {#1} {
\advance\scratchcounterone\plusone
}
\doloopovermatch {(\letterpercent w+)} {#1} {%
\advance\scratchcountertwo\plusone
\ifnum\scratchcountertwo=\plusone
% nothing
\orelse\ifnum\scratchcountertwo=\scratchcounterone
\space\letterampersand\space
\else
;\space
\fi
\AutorNombreApellido{##1}%
}
\stoptexdefinition
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\starttexdefinition AutorWhateverIndeed #1
\advance\scratchcountertwo\plusone
\ifnum\scratchcountertwo=\plusone
% nothing
\orelse\ifnum\scratchcountertwo=\scratchcounterone
\space\letterampersand\space
\else
;\space
\fi
\AutorNombreApellido{#1}%
\stoptexdefinition
\starttexdefinition AutorWhateverX #1
\getcommacommandsize[#1]%
\scratchcounterone\commalistsize
\scratchcountertwo\zerocount
\processcommacommand[#1]\AutorWhateverIndeed
\stoptexdefinition
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\defineautor[autores][rol={autor}]
\defineautor[andi][autores][nombres={Andrés Conrado}, apellidos={Montoya
Acosta}]
\defineautor[soni][autores][nombres={Sonia Amparo}, apellidos={Rodríguez
Rodríguez}]
\defineautor[sofi][autores][nombres={Sofía}, apellidos={Parra Albarracín}]
\definenamespace[autores][
type=module,
name=autor,
command=yes,
parent=autores,
]
\startdocument[autores={andi,soni,sofi}]
1: \AutorWhatever{\documentvariable{autores}} \blank
2: \AutorWhatever{andi,soni,sofi} \blank
3: \AutorWhatever{andi,soni} \blank
4: \AutorWhatever{soni} \blank
1: \AutorWhateverX{\documentvariable{autores}} \blank
2: \AutorWhateverX{andi,soni,sofi} \blank
3: \AutorWhateverX{andi,soni} \blank
4: \AutorWhateverX{soni} \blank
\stopdocument
-----------------------------------------------------------------
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 / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
prev parent reply other threads:[~2025-09-17 7:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-17 4:18 [NTG-context] " Andres Conrado Montoya
2025-09-17 7:28 ` Hans Hagen via ntg-context [this message]
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=e42c4f4e-a7cc-47e4-ab97-5555beb72ac8@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).