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 ___________________________________________________________________________________