[texhax] A useful macro?

Michael Barr mbarr at math.mcgill.ca
Sun Apr 23 19:00:49 CEST 2006


Looks just about perfect.

Thanks, Michael

On Sun, 23 Apr 2006, Philip TAYLOR wrote:

> Is this any use, Michael ?
> 
>          \def \seq #1{\innerseq #1,\sentinel}
> 
>          \def \innerseq #1,#2\sentinel%
>              {%
>               #1%
>               \ifx \sentinel #2\sentinel
>               \else
>                  ,\,\innerseq #2\sentinel
>               \fi
>              }
> 
>          \long \def \test #1{{\let \, = \relax \xdef \result {\seq {#1}}}{\tt \meaning \result}\par}
> 
>          \test {x,y,z}
>          \test {x_1,x_2,\ldots,x_n}
>          \test {x_1,x_2,x_3,\ldots}
> 
>          \end
> 
> Philip Taylor
> --------
> Michael Barr wrote:
> > Could someone design a macro, say call it \seq, such that any comma inside 
> > the parameter of \seq would expand to ,\, .  So that \seq{x,y,z} would 
> > give x,\,y,\,z, \seq{x_1,x_2,\ldots,x_n} would give 
> > x_1,\,x_2,\,\ldots,\,x_n , and \seq{x_1,x_2,x_3,\ldots} would give 
> > x_1,\,x_2,\,x_3,\,\ldots .  You could try giving it mathcode 8000 and 
> > defining it inside math mode to give ,\,  but there is no way to just have 
> > an ordinary comma then.
> > 
> > Michael Barr
> 



More information about the texhax mailing list