[NTG-context] How to extend an existing macro to take optional parameters?
Bruce Horrocks
ntg at scorecrow.com
Wed Mar 15 02:32:24 CET 2023
> On 14 Mar 2023, at 02:08, Alan Braslau via ntg-context <ntg-context at ntg.nl> wrote:
>
> Designating "optional" parameters within [...] is a LaTeX notion.
> ConTeXt handles parameters differently.
>
> Alan
Thanks Alan but I've never used LaTeX so I've no idea what the philosophical differences are.
I wanted three mandatory and two optional params. One of those optional params is not typeset so I assumed it should be [ ] delimited and not { }.
>
>>> and I'd like to be able to extend it so that any of the following
>>> can be used:
>>>
>>> \mycommand{aa}{bb}{cc}
>>> \mycommand{aa}{bb}{cc}{dd}
>>> \mycommand{aa}{bb}{cc}{dd}[ee]
>>>
>>> or
>>>
>>> \mycommand[ee]{aa}{bb}{cc}{dd} % if this is more the ConTeXt way
>>>
>>> where {dd} is the optional extra parameter and, if it is present,
>>> then [ee] can also be optionally added (because it controls how
>>> {dd} is printed).
â
Bruce Horrocks
Hampshire, UK
More information about the ntg-context
mailing list