ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Bruce Horrocks via ntg-context <ntg-context@ntg.nl>
To: ntg-context mailing list <ntg-context@ntg.nl>
Cc: Bruce Horrocks <ntg@scorecrow.com>
Subject: Re: How to extend an existing macro to take optional parameters?
Date: Wed, 15 Mar 2023 01:32:24 +0000	[thread overview]
Message-ID: <E0685720-BC78-485B-9A0C-91F3A5106637@scorecrow.com> (raw)
In-Reply-To: <20230313200852.0bf47214@boo.my.domain>



> On 14 Mar 2023, at 02:08, Alan Braslau via ntg-context <ntg-context@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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2023-03-15  1:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-12 13:24 Bruce Horrocks via ntg-context
2023-03-13 21:39 ` Hans Hagen via ntg-context
2023-03-14  2:08   ` Alan Braslau via ntg-context
2023-03-15  1:32     ` Bruce Horrocks via ntg-context [this message]
2023-03-15  1:27   ` Bruce Horrocks via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E0685720-BC78-485B-9A0C-91F3A5106637@scorecrow.com \
    --to=ntg-context@ntg.nl \
    --cc=ntg@scorecrow.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).