How to properly handle synonyms in \getparameters?
Dear gurus, This question concerns both MKII and MKIV (I need the functionality in both, even though I will try to rewrite the MKIV part as soon as I have time). I have a command: \mycommand[a][newparam=value] with more or less the following definition: \def\mycommand[#1][#2]{% \getparameters[@@mycommand@#1@][#2] % ... some extra code ... } However I used to use \mycommand[a][oldparam=value] and now I would like to switch the syntax to \mycommand[a][newparam=value] but I would like the oldparam to keep working normally. I will read the value with \@@mycommand@a@newparam. My question: what is the most elegant value to do that? I can imagine something like \def\mycommand[#1][#2]{% \undefinecommand\@@mycommand@a@oldparam % pseudocode \getparameters[@@mycommand@#1@][#2] \doifdefined{\@@mycommand@a@oldparam} \let\@@mycommand@a@newparam\@@mycommand@a@oldparam % ... some extra code ... } but there is most probably some more elegant solution to that? Thank you, Mojca
Am 03.09.2011 um 02:46 schrieb Mojca Miklavec:
Dear gurus,
This question concerns both MKII and MKIV (I need the functionality in both, even though I will try to rewrite the MKIV part as soon as I have time).
I have a command: \mycommand[a][newparam=value] with more or less the following definition: \def\mycommand[#1][#2]{% \getparameters[@@mycommand@#1@][#2] % ... some extra code ... }
However I used to use \mycommand[a][oldparam=value] and now I would like to switch the syntax to \mycommand[a][newparam=value] but I would like the oldparam to keep working normally.
I will read the value with \@@mycommand@a@newparam.
My question: what is the most elegant value to do that?
I can imagine something like \def\mycommand[#1][#2]{% \undefinecommand\@@mycommand@a@oldparam % pseudocode \getparameters[@@mycommand@#1@][#2] \doifdefined{\@@mycommand@a@oldparam} \let\@@mycommand@a@newparam\@@mycommand@a@oldparam % ... some extra code ... }
but there is most probably some more elegant solution to that?
MkIV: \definenamespace [mojca] [type=module, name=mojca, command=yes, setup=yes, parent=mojca] \starttext \setupmojca [oldkey=OLD, newkey=\mojcaparameter{oldkey}] \starttabulate \NC Old \EQ \mojcaparameter{oldkey} \NC\NR \NC New \EQ \mojcaparameter{newkey} \NC\NR \stoptabulate \setupmojca [newkey=NEW] \starttabulate \NC Old \EQ \mojcaparameter{oldkey} \NC\NR \NC New \EQ \mojcaparameter{newkey} \NC\NR \stoptabulate \stoptext Wolfgang
participants (2)
-
Mojca Miklavec
-
Wolfgang Schuster