LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

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

Print Reply
Lars Hellström <[log in to unmask]>
Tue, 25 Apr 2000 15:01:27 +0200
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 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 when I looked for it a couple
of weeks ago, nor is there anything with that name on CTAN.