From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/43713 Path: news.gmane.org!not-for-mail From: "Wolfgang Schuster" Newsgroups: gmane.comp.tex.context Subject: Re: system macros/doquadrupleemtpy Date: Thu, 4 Sep 2008 08:45:03 +0200 Message-ID: <115224fb0809032345u4c29ccf2o5b8f76df7d3535d7@mail.gmail.com> 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 1220515670 17696 80.91.229.12 (4 Sep 2008 08:07:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Sep 2008 08:07:50 +0000 (UTC) To: "mailing list for ConTeXt users" Original-X-From: ntg-context-bounces@ntg.nl Thu Sep 04 10:08:41 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 1Kb9tG-0000Dt-RI for gctc-ntg-context-518@m.gmane.org; Thu, 04 Sep 2008 10:08:30 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 978DF1FF36; Thu, 4 Sep 2008 10:07:25 +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-69; Thu, 4 Sep 2008 10:06:30 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 9A89A1FFDC; Thu, 4 Sep 2008 09:36:45 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 71F6E1FF51 for ; Thu, 4 Sep 2008 09:36:02 +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 01863-01-32 for ; Thu, 4 Sep 2008 09:34:58 +0200 (CEST) Original-Received: from rv-out-0708.google.com (rv-out-0708.google.com [209.85.198.251]) by ronja.ntg.nl (Postfix) with ESMTP id A68AB1FF58 for ; Thu, 4 Sep 2008 08:45:17 +0200 (CEST) Original-Received: by rv-out-0708.google.com with SMTP id f25so3828241rvb.14 for ; Wed, 03 Sep 2008 23:45:03 -0700 (PDT) Original-Received: by 10.141.86.14 with SMTP id o14mr5438322rvl.227.1220510703626; Wed, 03 Sep 2008 23:45:03 -0700 (PDT) Original-Received: by 10.140.204.12 with HTTP; Wed, 3 Sep 2008 23:45:03 -0700 (PDT) In-Reply-To: Content-Disposition: inline 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:43713 Archived-At: On Wed, Sep 3, 2008 at 4:41 PM, 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} > > \def\doCommand{% > \iffifthargument% > \doquadrupleargument\Command1% > \else% > \dotripleargument\Command2% > \fi} > > 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? > > Thanks, and best > > Thomas \def\Commanda {\doquadrupleempty\doCommanda} \def\doCommanda[#1][#2][#3][#4]% {\iffourthargument \def\next{\doCommandafive[#1][#2][#3][#4]}% \else \def\next{\doCommandafour[#1][#2][#3]}% \fi\next} \def\doCommandafive[#1][#2][#3][#4]#5% {five arguments} \def\doCommandafour[#1][#2][#3]#4% {four arguments} \def\Commandb {\doquadrupleempty\doCommandb} \def\doCommandb[#1][#2][#3][#4]% {\iffourthargument \def\next{\dodoCommandb[#1][#2][#3][#4]}% \else \def\next{\dodoCommandb[#1][#2][#3][]}% \fi\next} \def\dodoCommandb[#1][#2][#3][#4]#5% {\doifelsenothing{#4} {four arguments} {five arguments}} \starttext \Commanda[1][2][3][4]{5} \Commanda[1][2][3]{4} \Commandb[1][2][3][4]{5} \Commandb[1][2][3]4 \Commandb[1][2][3][]{4} % feature \stoptext Wolfgang ___________________________________________________________________________________ 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 ___________________________________________________________________________________