ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Andres Conrado Montoya via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Andres Conrado Montoya <andresconrado@gmail.com>
Subject: Macro for a comma separated list of authors
Date: Wed, 24 Nov 2021 19:09:29 -0500	[thread overview]
Message-ID: <CAGhDZhBtS=1oq73MQtE43k_h0C4-9JPVTsQqwUSTqXYVp7qGSA@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2502 bytes --]

I'm trying to produce a document with several authors, using macros for
comma separated lists. My MWE is as follows:

%%%%%%%%%%%%%%%%%%%%%%
\def\autores{%
  {Luis David Gómez-Méndez, Ph. D.},
  {Adriana del Pilar Pulido-Villamarín, M. Sc.},
  {Rubiela Castañeda-Salazar, M. Sc.},
  {Juan Carlos Ulloa-Rubiano, Ph. D.},
  {Adriana Matiz-Villamil, M. Sc.}%
}

\def\lastAutor{Fidson Juarismy Vesga-Pérez, Ph. D}

\def\autorParaLista#1{#1;\space}
\def\listaAutores{\processcommacommand[\autores]\autorParaLista &
\lastAutor: autores.}

\starttext

\listaAutores

\stoptext
%%%%%%%%%%%%%%%%%%%%%%%

So far, no luck trying to extract the last item from a comma separated
list. That's the reason I created a "\lastAutor" macro, so I can treat the
last one differently.

This produces:

%%%%%%
Luis David Gómez-Méndez, Ph.D.; Adriana del Pilar Pulido-Villamarín, M.
Sc.; Rubiela Castañeda-Salazar, M. Sc.; Juan Carlos Ulloa-Rubiano, Ph.D.;
Adriana Matiz-Villamil, M. Sc.; & Fidson Juarismy Vesga-Pérez, Ph.D:
autores.
%%%%%%

However, what I'm trying to get is:

%%%%%%
Luis David Gómez-Méndez, Ph.D.; Adriana del Pilar Pulido-Villamarín, M.
Sc.; Rubiela Castañeda-Salazar, M. Sc.; Juan Carlos Ulloa-Rubiano, Ph.D.;
Adriana Matiz-Villamil, M. Sc. & Fidson Juarismy Vesga-Pérez, Ph.D: autores.
%%%%%%

Which is very close to what I need, except the ";" just before the "&". So
the question is: is it possible to do this in a more effective or simpler,
or better way, and write a macro that outputs something like "Author1;
Author2; Author3 & Author4: authors.", given a comma separated list of
authors?

-- 
Andrés Conrado Montoya
Andi Kú
andresconrado@gmail.com
http://sesentaycuatro.com
http://messier87.com
http://chiquitico.org
----------------------------------------
Los fines no justifican los medios, porque la medida verdadera de nuestro
carácter está dada por los medios que estamos dispuestos a utilizar, no por
los fines que proclamamos.
----------------------------------------

“You develop an instant global consciousness, a people orientation, an
intense dissatisfaction with the state of the world, and a compulsion to do
something about it. From out there on the moon, international politics look
so petty. You want to grab a politician by the scruff of the neck and drag
him a quarter of a million miles out and say, ‘Look at that, you son of a
bitch.’” — Apollo 14 astronaut Edgar Mitchell

[-- Attachment #1.2: Type: text/html, Size: 3352 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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:[~2021-11-25  0:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25  0:09 Andres Conrado Montoya via ntg-context [this message]
2021-11-25  2:51 ` Jairo A. del Rio via ntg-context
2021-11-28  0:52 Andres Conrado Montoya 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='CAGhDZhBtS=1oq73MQtE43k_h0C4-9JPVTsQqwUSTqXYVp7qGSA@mail.gmail.com' \
    --to=ntg-context@ntg.nl \
    --cc=andresconrado@gmail.com \
    /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).