From: "Thomas A. Schmitz" <thomas.schmitz@uni-bonn.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: system macros/doquadrupleemtpy
Date: Thu, 4 Sep 2008 09:39:33 +0200 [thread overview]
Message-ID: <88E3260A-308F-4730-BC7A-1878ABEFBDE2@uni-bonn.de> (raw)
In-Reply-To: <alpine.DEB.1.00.0809031251560.29281@nqv-yncgbc>
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
___________________________________________________________________________________
next prev parent reply other threads:[~2008-09-04 7:39 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 [this message]
2008-09-03 18:32 ` Peter Rolf
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=88E3260A-308F-4730-BC7A-1878ABEFBDE2@uni-bonn.de \
--to=thomas.schmitz@uni-bonn.de \
--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).