From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/84948 Path: news.gmane.org!not-for-mail From: "Keith J. Schultz" Newsgroups: gmane.comp.tex.context Subject: Re: Need help defining command. Date: Tue, 22 Oct 2013 14:50:47 +0200 Message-ID: <42BD3192-4E5B-45D7-AD3A-74B1044CA841@uni-trier.de> References: <563CA660-912A-4857-9AA4-FB16AAD438EA@uni-trier.de> <549F71B5-2659-4E3E-8DC1-301D94771017@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1382446253 19674 80.91.229.3 (22 Oct 2013 12:50:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Oct 2013 12:50:53 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Oct 22 14:50:58 2013 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 1VYbQH-0006fP-Rp for gctc-ntg-context-518@m.gmane.org; Tue, 22 Oct 2013 14:50:57 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 03B8610229; Tue, 22 Oct 2013 14:48:03 +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 K5IWuI3eMkWO; Tue, 22 Oct 2013 14:48:01 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id EA69510215; Tue, 22 Oct 2013 14:48:00 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B3FCB10215 for ; Tue, 22 Oct 2013 14:47:59 +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 fk0YmCHG4CQf for ; Tue, 22 Oct 2013 14:47:55 +0200 (CEST) Original-Received: from filter4-ams.mf.surf.net (filter4-ams.mf.surf.net [192.87.102.72]) by balder.ntg.nl (Postfix) with ESMTP id F390E10212 for ; Tue, 22 Oct 2013 14:47:54 +0200 (CEST) Original-Received: from mx1.uni-trier.de (mx1.uni-trier.de [136.199.224.17]) by filter4-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r9MCtlEQ019432 for ; Tue, 22 Oct 2013 14:55:48 +0200 X-IronPort-AV: E=Sophos;i="4.93,548,1378850400"; d="scan'208";a="8732534" Original-Received: from rzmail.uni-trier.de ([136.199.8.220]) by mx1i.uni-trier.de with ESMTP; 22 Oct 2013 14:50:48 +0200 Original-Received: from [10.0.62.5] (dslb-084-059-011-127.pools.arcor-ip.net [84.59.11.127]) by rzmail.uni-trier.de (Postfix) with ESMTPA id 17E3A405A8 for ; Tue, 22 Oct 2013 14:50:48 +0200 (CEST) In-Reply-To: <549F71B5-2659-4E3E-8DC1-301D94771017@gmail.com> X-Mailer: Apple Mail (2.1510) X-Bayes-Prob: 0.0851 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=136.199.224.17; country=DE; region=08; city=Trier; latitude=49.7500; longitude=6.6333; http://maps.google.com/maps?q=49.7500,6.6333&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 01KEcTL8j - bda6ad81ecc0 - 20131022 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.72 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:84948 Archived-At: Hi Wolfgang, Am 22.10.2013 um 11:31 schrieb Wolfgang Schuster : > > Am 22.10.2013 um 10:34 schrieb Keith J. Schultz : > >> HI All, >> >> I remember seeing some seeing what I want to do but I can not find it. >> >> I would like to define a command that takes an optional key-valued list and >> 1 or 2 manditory ones. >> >> Something like >> >> \unexanded\def\MyCommand[#1]#2% >> {% >> \NassiGroupFrame[#1]{#2}% >> }% > > \unexanded\def\MyCommand > {\dosingleempty\doMyCommand} > > \def\doMyCommand[#1]#2% > {\NassiGroupFrame[#1]{#2}} > >> or >> >> \unexanded\def\MyCommand[#1]#2% >> {% >> % extract keyvalue >> \NassiGroupFrame[\width=\extractedvalueone]{hbox to \extractvaletwo{#2}}% >> }% > > \unexanded\def\MyCommand > {\dosingleempty\doMyCommand} > > \def\doMyCommand[#1]#2% > {\begingroup > \getdummyparameters[valueone=6cm,valuetwo=5cm,#1] > \NassiGroupFrame[width=\dummyparameter{valueone}]{\hbox to \dummyparameter{valuetwo}{#2}}% > \endgroup} > > \MyCommand[valuetwo=4cm]{...} > >> where \NassiGroupFrame is a Frame. >> >> To give you an idea why I need this see the MWE below. >> This is a relatively simple example, there will be more complicated frames and >> they will be nested. >> >> Maybe I am chasing windmills and there is a better way and I should use cld or lua for >> outputing the Frames so that I can have spacing between the command and avoid having >> to use "%" after the first opening "{". >> Or does someone know how it can be done. Is there a way to use ConTeXt to write the command > > There are ways to ignore the spaces at the begin (\ignorespaces) and end (\removeunwantedspaces) > of a group but you should rethink first your interface for your commands (why no start/stop commands). I thought about that, but I do not know I could use start/-commands in this context! regards Keith ___________________________________________________________________________________ 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 ___________________________________________________________________________________