From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/43703 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: system macros/doquadrupleemtpy Date: Wed, 3 Sep 2008 12:58:37 -0400 (EDT) Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1220472460 7267 80.91.229.12 (3 Sep 2008 20:07:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Sep 2008 20:07:40 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Sep 03 22:08:34 2008 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 lo.gmane.org with esmtp (Exim 4.50) id 1KayeX-00062o-K7 for gctc-ntg-context-518@m.gmane.org; Wed, 03 Sep 2008 22:08:33 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 74DAF1FED7; Wed, 3 Sep 2008 22:07:20 +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 08343-03-30; Wed, 3 Sep 2008 22:07:19 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 07D921FEA4; Wed, 3 Sep 2008 21:51:10 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id A4B0F1FF66 for ; Wed, 3 Sep 2008 21:50:48 +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 04879-02-32 for ; Wed, 3 Sep 2008 21:49:36 +0200 (CEST) Original-Received: from hellskitchen.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.82]) by ronja.ntg.nl (Postfix) with ESMTP id 8269A1FECF for ; Wed, 3 Sep 2008 18:58:38 +0200 (CEST) Original-Received: FROM adi-laptop.local (c-68-40-40-226.hsd1.mi.comcast.net [68.40.40.226]) BY hellskitchen.mr.itd.umich.edu ID 48BEC23D.8AC36.30835 ; 3 Sep 2008 12:58:37 -0400 In-Reply-To: User-Agent: Alpine 1.00 (DEB 882 2007-12-20) X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 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:43703 Archived-At: On Wed, 3 Sep 2008, Thomas A. Schmitz wrote: > Hi all, > > I'm trying to define a macro \Command which can either have four or > five arguments. If it has five, I want to define them as > > \Command1[#1][#2][#3][#4]{#5} > > if it has four, as > > \Command2[#1][#2][#3]{4#} > > I thought this would be the way to go: > > \def\Command{% > \doquadrupleempty\doCommand} You need something with possibly five arguments so you should use quint rather than quad: \def\Command% {\doquintupleargument\doCommand} > \def\doCommand{% > \iffifthargument% > \doquadrupleargument\Command1% > \else% > \dotripleargument\Command2% > \fi} The usual way is \def\doCommand[#1][#2][#3][#4][#5]% {\doifelsenothing{#5}%See below {\Command1[#1][#2][#3][#4][#5]} {\Command2[#1][#2][#3][#4]}} I use \doifelsenothing rather than \doiffirthargument. If I give \Command[...][...][...][...][] with \doifelsenothing \Commnad2 will be called while with \iffifthargument \Command1 will be called. Use whichever is more appropriate for your problem. > but that gives me errors about "too many }s". So I'm wondering: am I > on the wrong track? Can this be done at all? The above code is untested, but I am pretty sure that it will work. Aditya ___________________________________________________________________________________ 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________