Hi Arash,

On Thu, May 14, 2026 at 10:36 (+0200), Arash Esbati wrote:

> Jim via General discussion about AUCTeX <[email protected]> writes:

>> In ConTeXt there are commands with mandatory arguments that are
>> nonetheless surrounded by [], rather than {}.

>> I have tried various incantations, but I have not discovered any way
>> to make a [] argument mandatory but not have {} added as well.

>> For example, I can get '[' without making it appear an optional
>> argument with (TeX-arg-literal "["), but then I get {}.

>> Is there some solution to this that someone can tell me about?

> I'm also not aware of any pre-fabed function in AUCTeX for this.  But
> you can easily build your own like this:

> --8<---------------cut here---------------start------------->8---
> (defun ConTeXt-arg-mandatory-in-brackets (optional &rest args)
>   "Parse its arguments but use square brackets when they are inserted."
>   (let ((TeX-arg-opening-brace LaTeX-optop)
>         (TeX-arg-closing-brace LaTeX-optcl))
>     (if (equal (length args) 1)
>         (TeX-parse-argument optional (car args))
>       (TeX-parse-argument optional args))))
> --8<---------------cut here---------------end--------------->8---

> This is based on `TeX-arg-free' which is defined as:

<snip>

Thanks very much for pointing that out to me.  That works fine for the
particular case I was thinking of, and maybe with some slight changes I can
deal with some other similar cases in ConTeXt.


One question of possible interest to people on this list...

So far I've submitted some changes after submitting bug reports.  If one
wishes to do an "enhancement", is there a non-bug-report path for that?
(But, it is is easier, I can always submit a bug report about missing
functionality.)

Cheers.
                                Jim

Reply via email to