Thanks Otared,
that looks very promising. My attempt to wrap the arguments with \NC \NR fails, though.
It looks like only the first argument is used, and I am clearly missing something.
Also, I’d like to use the example you posted but without the last comma so that in the example below
I get (4,5) instead of (4,5,).
Matthias
\definemathmatrix
[pmatrix]
[left={\left(\,},right={\,\right)}]
\def\docolumnvector#1{\NC#1\NR}
\def\columnvector#1
{\startpmatrix
\processcommalist[#1]\docolumnvector
\stoppmatrix}
\def\dorowvector#1{#1,}
\def\rowvector#1
{\startpmatrix
\processcommalist[#1]\dorowvector
\stoppmatrix}
\starttext
\startformula
\columnvector{1,2,3}
\stopformula
\startformula
\rowvector{4,5}
\stopformula
\stoptext
On May 23, 2014, at 6:08 AM, Otared Kavian
Hi,
Some time ago Wolfgang S. gave a solution to a similar problem: maybe this can help you.
%%%% begin \def\somemacro#1% {\def\dosomemacro##1{Execute ##1, }% \processcommalist[#1]\dosomemacro}
\starttext \somemacro{A,B,C}
\somemacro{E,F} \stoptext %%%% end
Best regards: OK
On 23 May 2014, at 11:54, Matthias Weber
wrote: Dear All,
I would like to define a command that expands
\vector{2,4} % or vector[2,4] if that’s easier
to
\startpmatrix \NC 2 \NR \NC 4 \NR \stoppmatrix
and more generally
\vector{2,4,1,7}
to
\startpmatrix \NC 2 \NR \NC 4 \NR \NC 1 \NR \NC 7 \NR \stoppmatrix
Any hints how to achieve this?
Thanks,
Matthias ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________