From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/30427 Path: news.gmane.org!not-for-mail From: nico Newsgroups: gmane.comp.tex.context Subject: Re: How to \processcommalist inside another commalist? Date: Mon, 21 Aug 2006 22:51:18 +0200 Message-ID: References: <6faad9f00608210823p5beef0feia8b53c7ce734f83a@mail.gmail.com> <6faad9f00608211135r4639b3c5s3eda3346257fed90@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1156193132 3899 80.91.229.2 (21 Aug 2006 20:45:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 21 Aug 2006 20:45:32 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon Aug 21 22:45:29 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1GFGeG-0003aY-Fy for gctc-ntg-context-518@m.gmane.org; Mon, 21 Aug 2006 22:45:28 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id ED6421FDD5; Mon, 21 Aug 2006 22:45:26 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 29464-01; Mon, 21 Aug 2006 22:45:19 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id C313D1FCF6; Mon, 21 Aug 2006 22:45:18 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 507FC1FCF6 for ; Mon, 21 Aug 2006 22:45:15 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 11743-02 for ; Mon, 21 Aug 2006 22:45:11 +0200 (CEST) Original-Received: from swip.net (mailfe08.tele2.fr [212.247.154.236]) by ronja.ntg.nl (Postfix) with SMTP id 5FB811FCE8 for ; Mon, 21 Aug 2006 22:45:09 +0200 (CEST) X-T2-Posting-ID: 3brHPWvyEzVNt0QNlxQWsxGJRDYe7rueGgqwO1zxZAg= X-Cloudmark-Score: 0.000000 [] Original-Received: from [83.179.209.137] (HELO localhost) by mailfe08.swip.net (CommuniGate Pro SMTP 5.0.8) with ESMTP id 258317943 for ntg-context@ntg.nl; Mon, 21 Aug 2006 22:45:07 +0200 Original-To: "mailing list for ConTeXt users" In-Reply-To: <6faad9f00608211135r4639b3c5s3eda3346257fed90@mail.gmail.com> User-Agent: Opera M2/7.54 (FreeBSD, build 955) X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:30427 Archived-At: On Mon, 21 Aug 2006 20:35:27 +0200, Mojca Miklavec wrote: >> %% Why using parameter for this? > > I was sure that someone would ask that. I want to provide optional > parameters for both numbers and scaling: > \useGNUPLOTgraphic[name] > or > \useGNUPLOTgraphic[name][width=.9\textwidth] > or > \useGNUPLOTgraphic[name][n={1,3}] > or > \useGNUPLOTgraphic[name][n={1,3},width=.9\textwidth] > > but after some thinking I realized that it would indeed be a better > idea (less to type?) to have > \useGNUPLOTgraphic[name][1,3] > and > \useGNUPLOTgraphic[name][1,3][width=.9\textwidth] > instead. > > At the beginning the main reason against it was that I didn't know how > to distinguish which kind of parameters are being used in the second > pair of brackets, but I guess that I can safely use \ifnumberelse as a > test on the first item to distinguish between the two. Maybe you could play only with the parameter count. The limitation is that an empty second argument is required when only options need to be passed. \def\printPrime#1{#1 is prime.\crlf} \def\useGNUPLOTgraphic {\dotripleempty\douseGNUPLOTgraphic} \def\douseGNUPLOTgraphic[#1][#2][#3]% {\ifthirdargument \doprime{#2} parameters are #3 \getparameters[gnuplot][#3] \else\ifsecondargument \doprime{#2} \fi\fi} \def\doprime#1{\processcommalist[#1]\printPrime} \starttext \useGNUPLOTgraphic[name] \useGNUPLOTgraphic[name][2,3,5] \useGNUPLOTgraphic[name][3,5,7][width=2in] \useGNUPLOTgraphic[name][][width=4in] \stoptext Regards, BG