[NTG-context] Treat last element in a commalist differently
Aditya Mahajan
adityam at umich.edu
Fri Jun 2 22:34:07 CEST 2006
Hi,
I am trying to write a macro so that
\SEQ X[1,2,3] expands to $X_1, X_2, X_3$
\SEQ X[1-N] expands to $X_1, \dots, X_N$
and
\SEQ X expands to ${\bf X}$.
So far I have
\def\SEQ#1%
{\dodoubleempty\doSEQ[#1]}
\def\doSEQ[#1][#2]%
{\ifsecondargument \mathematics{\processcommalist[#2]{\dodoSEQ{#1}}}
\else \mathematics{\bold{#1}}\fi}
\def\dodoSEQ#1#2%
{#1_{#2},}
\starttext
\SEQ X[1,2,3] is part of \SEQ X.
\stoptext
There is an extra comma at the end. That is,
\SEQ X[1,2,3] expands to $X_1,X_2,X_3,$
^^^
How can I treat the last element of a commalist differently?
Thanks,
Aditya
More information about the ntg-context
mailing list