On 1/10/2025 12:55 PM, Henning Hraban Ramm wrote:
Hi, I just recognized that I’m not sure how to define a macro with optional and mandatory arguments the best way.
E.g. (oldfashioned)
\def\doMyMacro[#1]#2% {Do something ... \iffirstargument #1\fi #2}
\def\MyMacro% {\dosingleargument\doMyMacro}
\tolerant\def\MyMacro[#1]#:#2% {\ifparameter#1\or (#1) \fi /#2/} \MyMacro[one]{two} \MyMacro{two}
Is this still the way to do it? Does it also work with \define?
I have more questions like that:
From Wolfgang’s presentation (article in progress…) I know all the cool stuff for modules (namespaces, setup helpers…), I also know the Lua way of interface.implement, but how to combine those?
When should I use brackets or other characters in a definition, when not?
optionals normally have []
Which docs should I read?
how about lowlevel-macros .. but haven't you read all of them by now ? Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------