On Fri, 2 Jun 2006, Aditya Mahajan wrote: > 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
On Fri, 2 Jun 2006, Taco Hoekwater wrote: > It is much easier to treat the first element as special: > > \def\doSEQ[#1][#2]% > {\ifsecondargument > \donefalse > \mathematics{\processcommalist[#2]{\dodoSEQ{#1}}} > \else \mathematics{\bold{#1}}\fi} > > \def\dodoSEQ#1#2% > {\ifdone ,\else \donetrue\fi#1_{#2}} > This is the final macro that I have, incase someone else is interested. \def\SEQ#1% {\dodoubleempty\doSEQ[#1]} \def\doSEQ[#1][#2]% {\ifsecondargument \donefalse \mathematics{\processcommalist[#2]{\dodoSEQ{#1}}} \else \mathematics{\bold{#1}}\fi} \def\dodoSEQ#1#2% {\ifdone ,\else \donetrue\fi \doifelse{#2}{...}{\dots}{#1_{#2}}} \starttext \SEQ X[1,2] is part of \SEQ X[1,2,3,4] and \SEQ X[1,...,10] \SEQ X[1,2,...,n-1,n,n+1,...,N] \stoptext Aditya _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context