From: Matthias Weber <matweber@indiana.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Simple command with variable number of arguments
Date: Fri, 23 May 2014 06:55:04 -0400 [thread overview]
Message-ID: <F03671BD-54B3-42EB-A949-3586C0AE1381@indiana.edu> (raw)
In-Reply-To: <88224861-86DA-4A37-BEDC-66F9A3F822D4@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2765 bytes --]
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 <otared@gmail.com> wrote:
> 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 <matweber@indiana.edu> 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
> ___________________________________________________________________________________
[-- Attachment #1.2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 842 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2014-05-23 10:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-23 9:54 Matthias Weber
2014-05-23 10:08 ` Otared Kavian
2014-05-23 10:55 ` Matthias Weber [this message]
2014-05-23 10:56 ` Aditya Mahajan
2014-05-23 11:14 ` Matthias Weber
2014-05-23 11:37 ` Aditya Mahajan
2014-05-23 12:08 ` Matthias Weber
2014-05-23 11:44 ` luigi scarso
2014-05-23 12:12 ` Matthias Weber
[not found] <mailman.56.1400848757.2240.ntg-context@ntg.nl>
2014-05-23 13:48 ` Jeong Dal
2014-05-23 18:00 ` Hans Hagen
[not found] ` <537FA66D.3000608@wxs.nl>
2014-05-24 0:36 ` Jeong Dal
2014-05-24 6:55 ` Jeong Dal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=F03671BD-54B3-42EB-A949-3586C0AE1381@indiana.edu \
--to=matweber@indiana.edu \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).