ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Peter Rolf <indiego@gmx.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: system macros/doquadrupleemtpy
Date: Wed, 03 Sep 2008 20:32:05 +0200	[thread overview]
Message-ID: <48BED825.9090100@gmx.net> (raw)
In-Reply-To: <F55E008D-0D0E-4826-8B16-0A7EC3B2D6CD@uni-bonn.de>

Thomas A. Schmitz schrieb:
> 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?
>

Hi Thomas!

Hard to say for me whats wrong, but I think its a bad idea to use such
optional parameter commands in a nested way. Also there is no need for a
second parameter number check.

How about something like

\def\doCommand%
  {\iffifthargument
     \CommandA[#1][#2][#3][#4]{#5}%
   \else\iffourthargument
       \CommandB[#1][#2][#3]{#4}%
     \else
       % some error handling
     \fi
   \fi}


Best wishes, Peter

> Thanks, and best
> 
> 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
> ___________________________________________________________________________________
> 

___________________________________________________________________________________
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
___________________________________________________________________________________


  parent reply	other threads:[~2008-09-03 18:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-03 14:41 Thomas A. Schmitz
2008-09-03 16:58 ` Aditya Mahajan
2008-09-04  7:39   ` Thomas A. Schmitz
2008-09-03 18:32 ` Peter Rolf [this message]
2008-09-04  6:45 ` Wolfgang Schuster
2008-09-04  8:21   ` Thomas A. Schmitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48BED825.9090100@gmx.net \
    --to=indiego@gmx.net \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).