LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
From: Lars Hellström <[log in to unmask]>
Date: Tue, 25 Apr 2000 15:01:27 +0200
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
Parts/Attachments: text/plain (29 lines)
It recently occured to me that when you use a \@for (or one of its
relatives) loop to generate something that gets typeset, you often want to
do things slightly different at the first or last iteration. Therefore, how
about including in LaTeX2e* a command
  \@fancyfor <command> := <list> \do{<first>}{<middle>}{<last>}
say, which is like \@for except for the fact that it does <first> on the
first iteration, <last> on the last (unless that's the first), and <middle>
on the others? With that, you could write
  \@fancyfor\@tempa:=<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

This will of course need some thinking about; perhaps these are not the
best rules for which body gets executed when; perhaps the command should
not be constructed as a variant of \@for, but rather as some map over a
LaTeX3 sequence. But regardless of this, I think that some command in the
future standard language (be that LaTeX 2e+required, 2e*, or 3) should
offer this kind of feature, since doing special things at the end is so
useful to have, but so laborious to code.

Lars Hellström

PS: What happened to the promised (FMi 2000/03/07) trace package? I didn't
see anything like it on www.latex-project.org when I looked for it a couple
of weeks ago, nor is there anything with that name on CTAN.

ATOM RSS1 RSS2