I want to define a macro that defines a series of other macros, each of which takes a variable (but in any given document fixed) number of arguments. I know that I can do this using something like this:
\documentclass{standalone}
\newcommand\MakeCommands[1]{%
\ifcase#1\relax%
\or\newcommand\MyCommand[1]{##1}%
\or\newcommand\MyCommand[2]{##1, ##2}%
\or\newcommand\MyCommand[3]{##1, ##2, ##3}%
\or\newcommand\MyCommand[3]{##1, ##2, ##3, ##4}%
\fi%
}
\begin{document}
\MakeCommands{3}
\MyCommand{one}{two}{three}
\end{document}
but I am sure that there is a better way of doing this...I get the feeling that it is time I learnt to use keys...
Does anyone have a better solution?
\MyCommand{one,two,three}
, and let TeX process the comma list separating items with,
.\MyCommand{one=first, two=second, three=third}
.