On 4/26/24 18:18, Wolfgang Schuster wrote:
> Pablo Rodriguez via ntg-context schrieb am 26.04.2024 um 17:29:
>> What is wrong in my definition above?
>
> There is nothing wrong, this is just a side effect of the scanner used
> with the \do...groupempty commands. To have more control about this
> behavior use the \tolerant modifier for \def to change it.

Many thanks for your reply, Wolfgang.

I tried this approach (I hope it isn’t wrong):

  \starttext
  \expanded\tolerant\def\MyCommand#_#,#_#,#_#,#_{%
    \doiftextelse{#4}%
      {#4}
      {\doiftextelse{#3}
        {#3}
        {#2}}}

  \MyCommand{}{second}{third}{fourth},\\
  \MyCommand{}{second}{third}{fourth} e,\\

  \MyCommand{}{second}{third},\\
  \MyCommand{}{second}{third} e,\\

  \MyCommand{}{second},\\
  \MyCommand{}{second} e,\\
  \stoptext

BTW, this is the first time I see #_ instead of #1.

There is no way to search for "#_" in the wiki.

Grepping the source, "#_" seems to be used for optional arguments
(mainly in syst-aux.mkxl).

But what are these "#_" (which don’t seem to come from TeX)?

Many thanks for your help,

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to