From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/43714 Path: news.gmane.org!not-for-mail From: "Thomas A. Schmitz" Newsgroups: gmane.comp.tex.context Subject: Re: system macros/doquadrupleemtpy Date: Thu, 4 Sep 2008 09:39:33 +0200 Message-ID: <88E3260A-308F-4730-BC7A-1878ABEFBDE2@uni-bonn.de> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v926) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1220516663 22834 80.91.229.12 (4 Sep 2008 08:24:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Sep 2008 08:24:23 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Sep 04 10:25:17 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 1KbA9U-0005jW-L9 for gctc-ntg-context-518@m.gmane.org; Thu, 04 Sep 2008 10:25:16 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id C14351FFC4; Thu, 4 Sep 2008 10:24:13 +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 09715-06-23; Thu, 4 Sep 2008 10:23:26 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 562B31FE69; Thu, 4 Sep 2008 10:09:57 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 908D91FE69 for ; Thu, 4 Sep 2008 10:09: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 30972-02-72 for ; Thu, 4 Sep 2008 10:09:03 +0200 (CEST) Original-Received: from mailout04.t-online.de (mailout04.t-online.de [194.25.134.18]) by ronja.ntg.nl (Postfix) with ESMTP id CE98F1FF05 for ; Thu, 4 Sep 2008 09:39:56 +0200 (CEST) Original-Received: from fwd35.aul.t-online.de by mailout04.sul.t-online.de with smtp id 1Kb9Rc-0003GO-03; Thu, 04 Sep 2008 09:39:56 +0200 Original-Received: from [192.168.0.2] (bM+jeTZHohBq6m4212vE4yAOseanRE7Agh4ew5LCEjknoy4b268JXqbGsmk68edQsi@[87.178.100.44]) by fwd35.aul.t-online.de with esmtp id 1Kb9RF-1WRkTw0; Thu, 4 Sep 2008 09:39:33 +0200 In-Reply-To: X-Mailer: Apple Mail (2.926) X-ID: bM+jeTZHohBq6m4212vE4yAOseanRE7Agh4ew5LCEjknoy4b268JXqbGsmk68edQsi@t-dialin.net X-TOI-MSGID: ddd7cbf5-cee8-4083-ad8c-9ff4ec38a908 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:43714 Archived-At: Aditya, Peter, as always, thanks a lot for your help. Peter, you're certainly right that it's difficult to diagnose my problem - I'm sending only snippets, no example. But it's a fairly complex thing here for my presentation module and difficult to reduce in size. On Sep 3, 2008, at 6:58 PM, Aditya Mahajan wrote: > 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. > OK, that does make sense, but now I also see where my problem lies. When I define \doCommand[#1][#2][#3][#4]#5 and then have \Command2[#1][#2][#3]#4 TeX picks up a closing bracket as #4. I suspect that my problem lies in the definition \doCommand[#1][#2][#3][#4]#5 . The two definitions don't match; when I look at \doCommand, the closing bracket is indeed argument #4, from TeX's point of view. Maybe I need to reverse the order of my arguments and make it \doCommand#1[#2][#3][#4][#5] ? but I'm not sure if this would play with quintupleempty... Anyway, thanks a lot for your help. I'll look further into it and will maybe come back with a real example later if I can't figure it out. Thomas ___________________________________________________________________________________ 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 ___________________________________________________________________________________