Received: via tmail-4.1(11) (invoked by user schoepf) for schoepf; Wed, 26 Apr 2000 16:48:20 +0200 (MET DST) Received: from mailgate1.zdv.Uni-Mainz.DE (mailgate1.zdv.Uni-Mainz.DE [134.93.8.56]) by mail.Uni-Mainz.DE (8.9.3/8.9.3) with ESMTP id QAA14656 for ; Wed, 26 Apr 2000 16:48:20 +0200 (MET DST) Received: from mail.listserv.gmd.de (mail.listserv.gmd.de [192.88.97.5]) by mailgate1.zdv.Uni-Mainz.DE (8.9.3/8.9.3) with ESMTP id QAA28593 for ; Wed, 26 Apr 2000 16:48:18 +0200 (MET DST) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01BFAF8E.769ED200" Received: from mail.listserv.gmd.de (192.88.97.5) by mail.listserv.gmd.de (LSMTP for OpenVMS v1.1a) with SMTP id <12.81D2D6EF@mail.listserv.gmd.de>; Wed, 26 Apr 2000 16:47:01 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Received: from RELAY.URZ.UNI-HEIDELBERG.DE by RELAY.URZ.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 1.8b) with spool id 456796 for LATEX-L@RELAY.URZ.UNI-HEIDELBERG.DE; Wed, 26 Apr 2000 16:48:14 +0200 Received: from ix.urz.uni-heidelberg.de (mail.urz.uni-heidelberg.de [129.206.119.234]) by relay.urz.uni-heidelberg.de (8.8.8/8.8.8) with ESMTP id QAA24774 for ; Wed, 26 Apr 2000 16:48:13 +0200 (MET DST) Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by ix.urz.uni-heidelberg.de (8.8.8/8.8.8) with ESMTP id QAA28950 for ; Wed, 26 Apr 2000 16:48:13 +0200 Received: from ams.org (sun06.ams.org [130.44.1.6]) by relay.uni-heidelberg.de (8.9.3+Sun/8.9.3) with ESMTP id QAA25918 for ; Wed, 26 Apr 2000 16:48:13 +0200 (MET DST) Received: (from mjd@localhost) by ams.org (8.9.3/8.9.3) id KAA27656; Wed, 26 Apr 2000 10:48:11 -0400 (EDT) In-Reply-To: Lars Hellström's message of Tue, 25 Apr 2000 15:01:27 +0200 Lines: 72 References: Return-Path: X-Mailer: Gnus v5.5/Emacs 20.2 x-vm-v5-data: ([nil nil nil nil nil nil nil nil nil]["2981" "Wed" "26" "April" "2000" "10:48:10" "-0400" "Michael John Downes" "mjd@AMS.ORG" nil "73" "Re: A fancier \\@for" "^Date:" nil nil "4" nil nil nil nil nil]nil) Content-class: urn:content-classes:message Subject: Re: A fancier \@for Date: Wed, 26 Apr 2000 15:48:10 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Michael John Downes" Sender: "Mailing list for the LaTeX3 project" To: "Multiple recipients of list LATEX-L" Reply-To: "Mailing list for the LaTeX3 project" Status: R X-Status: X-Keywords: X-UID: 3577 This is a multi-part message in MIME format. ------_=_NextPart_001_01BFAF8E.769ED200 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Lars Hellstr=F6m writes: > \@fancyfor\@tempa:=3D\do{\@tempa}{, \@tempa}{ and \@tempa} > and for equal to A; A,B; A,B,C; A,B,C,D respectively get the = results > A > A and B > A, B and C > A, B, C and D As it happens I was working on similar functionality recently for the amsrefs package (ftp://ftp.ams.org/pub/tex/amsrefs.zip). The package has a \PrintSeries function used to print author names in a bibliography when the data is a list of names in the form \name{Downes, Michael}\name{Hellstr=F6m, Lars}... For AMS conventions your first/middle/last approach is not quite adequate because cases 2 and 3 must be printed as A and B A, B, and C (Note the extra comma.) And there are some other complications, as explained in the following commentary from amsrefs.dtx: % The \cn{PrintSeries} command prints a list of objects in series % form. The essential idea is to produce something like \qq{A, B, and % C} when we are given three elements A B C, with suitable variations % in the punctuation and other intervening material if the number of % elements is less or more than three. % % To generalize this process, we envision \cn{PrintSeries} being % called as %\PrintSeries{i0}{i1}{i2}{i3}{i4}{\do{A}\do{B}...} % where i0, \dots, i4 are material to be interpolated and the last % arg is a list of indeterminate length where each element consists % of a macro and its argument. The output, depending on the number of % elements, will be % i0 A i4 % 1 element % i0 A i1 B i4 % 2 elements % i0 A i2 B i3 C i4 % 3 elements % i0 A i2 B i2 C i2 ... X i2 Y i3 Z i4 % 26 elements % That is the simple explanation but in practice there are some % additional complications. What if user-supplied line breaks have to % be supported at the boundaries between elements? What if in % addition to adding material between elements we also want to apply % some handy function to each element (e.g., \cn{textsc})? Even % worse, what if we want the function to be different depending on % the position of the element in the list?? Indeed if this did not % happen to be the case with the current application I would not have % gone to the extra trouble of supporting it. But if it must be so, % then the output that we need from a list \verb'\do{A}\do{B}...' is % f0{A} % f0{A} p1 i1 f1{B} % f0{A} p2 i2 f2{B} p3 i3 f3{B} % and so on, where % \begin{itemize} % \item $f_n$ is a macro taking one argument, % \item $p_n$ is punctuation\mdash material that must precede a line % break if one occurs at this boundary, % \item $i_n$ other interpolated material, as before. % \end{itemize} % To reduce the number of distinct required objects we decree that % each element will get braces wrapped around it as a matter of % course; then it is possible for f1, f2, f3 to be assimilated into % the tail end of i1, i2, i3. ------_=_NextPart_001_01BFAF8E.769ED200 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Re: A fancier \@for

Lars Hellstr=F6m <Lars.Hellstrom@MATH.UMU.SE> = writes:

>   = \@fancyfor\@tempa:=3D<list>\do{\@tempa}{, \@tempa}{ and = \@tempa}
> and for <list> equal to A; A,B; A,B,C; = A,B,C,D respectively get the results
>   A
>   A and B
>   A, B and C
>   A, B, C and D

As it happens I was working on similar functionality = recently for the
amsrefs package (ftp://ftp.ams.org/pub/tex/= amsrefs.zip). The package has
a \PrintSeries function used to print author names in = a bibliography
when the data is a list of names in the form

  \name{Downes, Michael}\name{Hellstr=F6m, = Lars}...

For AMS conventions your first/middle/last approach is = not quite
adequate because cases 2 and 3 must be printed = as

  A and B
  A, B, and = C         (Note the extra = comma.)

And there are some other complications, as explained = in the following
commentary from amsrefs.dtx:

%    The \cn{PrintSeries} command = prints a list of objects in series
%    form. The essential idea is to = produce something like \qq{A, B, and
%    C} when we are given three = elements A B C, with suitable variations
%    in the punctuation and other = intervening material if the number of
%    elements is less or more than = three.
%
%    To generalize this process, we = envision \cn{PrintSeries} being
%    called as

%\PrintSeries{i0}{i1}{i2}{i3}{i4}{\do{A}\do{B}...}

%    where i0, \dots, i4 are material = to be interpolated and the last
%    arg is a list of indeterminate = length where each element consists
%    of a macro and its argument. The = output, depending on the number of
%    elements, will be

% i0 A = i4            = ;     % 1 element
% i0 A i1 B = i4            % 2 = elements
% i0 A i2 B i3 C = i4       % 3 elements
% i0 A i2 B i2 C i2 ... X i2 Y i3 Z i4   % = 26 elements

%    That is the simple explanation but = in practice there are some
%    additional complications. What if = user-supplied line breaks have to
%    be supported at the boundaries = between elements? What if in
%    addition to adding material = between elements we also want to apply
%    some handy function to each = element (e.g., \cn{textsc})? Even
%    worse, what if we want the = function to be different depending on
%    the position of the element in = the list?? Indeed if this did not
%    happen to be the case with the = current application I would not have
%    gone to the extra trouble of = supporting it. But if it must be so,
%    then the output that we need from = a list \verb'\do{A}\do{B}...' is

% f0{A}
% f0{A} p1 i1 f1{B}
% f0{A} p2 i2 f2{B} p3 i3 f3{B}

%    and so on, where
% \begin{itemize}
% \item $f_n$ is a macro taking one argument,
% \item $p_n$ is punctuation\mdash material that must = precede a line
%    break if one occurs at this = boundary,
% \item $i_n$ other interpolated material, as = before.
% \end{itemize}
%    To reduce the number of distinct = required objects we decree that
%    each element will get braces = wrapped around it as a matter of
%    course; then it is possible for = f1, f2, f3 to be assimilated into
%    the tail end of i1, i2, = i3.

------_=_NextPart_001_01BFAF8E.769ED200--