From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/87523 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: Simple command with variable number of arguments Date: Fri, 23 May 2014 07:37:29 -0400 Message-ID: <9C210B5D-FF75-4C17-8AB6-0255A8664817@umich.edu> References: <6EAF5FDE-7BE4-4766-B683-FA9994227A04@indiana.edu> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (1.0) Content-Type: multipart/mixed; boundary="===============0717490388==" X-Trace: ger.gmane.org 1400845079 23717 80.91.229.3 (23 May 2014 11:37:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 23 May 2014 11:37:59 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri May 23 13:37:54 2014 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WnnnM-0002jT-F5 for gctc-ntg-context-518@m.gmane.org; Fri, 23 May 2014 13:37:52 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 1F28410226 for ; Fri, 23 May 2014 13:37:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 8fLCwsAFdzc5 for ; Fri, 23 May 2014 13:37:52 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 7AFF110229 for ; Fri, 23 May 2014 13:37:47 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 9F87B101EC for ; Fri, 23 May 2014 13:37:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id WBVLUAxQTmZF for ; Fri, 23 May 2014 13:37:41 +0200 (CEST) Original-Received: from filter1-ams.mf.surf.net (filter1-ams.mf.surf.net [192.87.102.69]) by balder.ntg.nl (Postfix) with ESMTP id CFFB2101E8 for ; Fri, 23 May 2014 13:37:41 +0200 (CEST) Original-Received: from orford.cim.mcgill.ca (orford.cim.mcgill.ca [132.206.73.2]) by filter1-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id s4NBbUHm013900 for ; Fri, 23 May 2014 13:37:40 +0200 Original-Received: from [192.168.2.29] (unknown [135.0.226.162]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: adityam) by orford.cim.mcgill.ca (Postfix) with ESMTPSA id 77561F7C52; Fri, 23 May 2014 07:37:29 -0400 (EDT) In-Reply-To: X-Mailer: iPad Mail (11D167) X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=132.206.73.2; country=CA; region=Quebec; city=Montreal; latitude=45.5181; longitude=-73.6545; http://maps.google.com/maps?q=45.5181,-73.6545&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0NM5nBuVL - ed76f1165721 - 20140523 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.69 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:87523 Archived-At: --===============0717490388== Content-Type: multipart/alternative; boundary=Apple-Mail-B31E36E3-4B23-48FA-BE7F-BD047B6B77AA Content-Transfer-Encoding: 7bit --Apple-Mail-B31E36E3-4B23-48FA-BE7F-BD047B6B77AA Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On May 23, 2014, at 7:14 AM, Matthias Weber wrote: >=20 > Thanks Aditya, >=20 > but out of the box the following >=20 > \usemodule[simplematrix] >=20 > \definesimplematrix[MATRIX][fence=3Dbracket] >=20 > \starttext >=20 > \startformula > \MATRIX{1,2,3} > \MATRIX{1;2;3}=20 > \stopformula >=20 > \stoptext >=20 > gives me=20 > > Matthias >=20 Strange. What version of context are you using?=20 Aditya >=20 >> On May 23, 2014, at 6:56 AM, Aditya Mahajan wrote: >>=20 >>> On Fri, 23 May 2014, Matthias Weber wrote: >>>=20 >>> Dear All, >>>=20 >>> I would like to define a command that expands >>>=20 >>> \vector{2,4} % or vector[2,4] if that=E2=80=99s easier >>>=20 >>> to >>>=20 >>> \startpmatrix >>> \NC 2 \NR >>> \NC 4 \NR >>> \stoppmatrix >>>=20 >>> and more generally >>>=20 >>> \vector{2,4,1,7} >>>=20 >>> to >>>=20 >>> \startpmatrix >>> \NC 2 \NR >>> \NC 4 \NR >>> \NC 1 \NR >>> \NC 7 \NR >>> \stoppmatrix >>>=20 >>> Any hints how to achieve this? >>=20 >> Surprisingly, this is not as simple as it may seem at first glance. Some t= ime ago, I had written a module to achieve this. See attached. The usage is:= >>=20 >> \usemodule[simplematrix] >>=20 >> \definesimplematrix[MATRIX][fence=3Dbracket] >>=20 >> (any predefined math-fence will work) and then: >>=20 >> \MATRIX{1,2,3} for row vectors and \MATRIX{1;2;3} for column vectors, and= \MATRIX{1,2,3; 4,5,6} for matrices. >>=20 >> You can use \definesimplematrix[...][distance=3D..., align=3D...] to infl= uence the distance and align keys of mathmatrix. >>=20 >> Aditya______________________________________________= _____________________________________ >> If your question is of interest to others as well, please add an entry to= the Wiki! >>=20 >> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-co= ntext >> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net >> archive : http://foundry.supelec.fr/projects/contextrev/ >> wiki : http://contextgarden.net >> _________________________________________________________________________= __________ >=20 > __________________________________________________________________________= _________ > If your question is of interest to others as well, please add an entry to t= he Wiki! >=20 > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-con= text > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > __________________________________________________________________________= _________ --Apple-Mail-B31E36E3-4B23-48FA-BE7F-BD047B6B77AA Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On May 23, 2014, at 7:14 AM, Matthias W= eber <matweber@indiana.edu>= ; wrote:

Thanks Aditya= ,

but out of the box the following

\usemodule[simplematrix]

\definesimplematri= x[MATRIX][fence=3Dbracket]

\starttext
\startformula
\MATRIX{1,2,3}
\MATRIX{1;2;3}&= nbsp;
\stopformula

\stoptext
gives me 
<texshop_image.pdf>
Matthias

=

Strange. What version of contex= t are you using? 

Aditya

<= br>

On May 23, 2= 014, at 6:56 AM, Aditya Mahajan <adi= tyam@umich.edu> wrote:

<= blockquote type=3D"cite">
On Fri, 23 May 2014, Matthias Weber wrote:

Dear All,

I would like to define a command that e= xpands

\vector{2,4} % or vector[2,4] if that=E2=80=99s easier

= to

\startpmatrix
\NC 2 \NR
\NC 4 \NR
\stoppmatrix

and= more generally

\vector{2,4,1,7}

to

\startpmatrix
\N= C 2 \NR
\NC 4 \NR
\NC 1 \NR
\NC 7 \NR
\stoppmatrix

Any hi= nts how to achieve this?

Surprisingly, this is not as si= mple as it may seem at first glance. Some time ago, I had written a module t= o achieve this. See attached. The usage is:

\usemodule[simplematrix]<= br>
\definesimplematrix[MATRIX][fence=3Dbracket]

(any predefined m= ath-fence will work) and then:

\MATRIX{1,2,3} for row vectors and \MA= TRIX{1;2;3} for column vectors, and \MATRIX{1,2,3; 4,5,6} for matrices.
<= br>You can use \definesimplematrix[...][distance=3D..., align=3D...] to infl= uence the distance and align keys of mathmatrix.

Aditya<t-si= mplematrix.mkvi>__________________________________________________= _________________________________
If your question is of interest to othe= rs as well, please add an entry to the Wiki!

maillist : n= tg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-contex= t
webpage  : <= a href=3D"http://www.pragma-ade.nl/">http://www.pragma-ade.nl / http://tex.aanhet.net=
archive  : http://foundry.supelec.= fr/projects/contextrev/
wiki     : ht= tp://contextgarden.net
______________________________________________= _____________________________________
________________________= ___________________________________________________________
= If your question is of interest to others as well, please add an entry to th= e 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
____________________________= _______________________________________________________
= --Apple-Mail-B31E36E3-4B23-48FA-BE7F-BD047B6B77AA-- --===============0717490388== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============0717490388==--