* [NTG-context] define math function with \, inside
@ 2023-05-01 15:19 Stefan Haller via ntg-context
2023-05-01 15:48 ` Mikael Sundqvist via ntg-context
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Haller via ntg-context @ 2023-05-01 15:19 UTC (permalink / raw)
To: ntg-context; +Cc: Stefan Haller
Hi all,
I wanted to define a custom math function (similar to log etc.) for
argmax. However, I wanted to have a small space between "arg" and "max"
and limits should work properly. I am using a up-to-date LMTX installation.
Without the first constraint it's easy:
> % old way:
> \definemathcommand[argmax][limop]{\mfunction[argmax]}
> % new way, discoverd by looking into math-def.mkxl
> \definemathfunction[argmax]
However, both methods do not work if I want to have "arg\,max" printed
(error about \endcsname missing). With mkiv the first method works and
can also be found in the wiki[1].
What's the current way to define such a custom math function?
Thanks!
Stefan
[1]: https://wiki.contextgarden.net/Math/functions
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [NTG-context] define math function with \, inside
2023-05-01 15:19 [NTG-context] define math function with \, inside Stefan Haller via ntg-context
@ 2023-05-01 15:48 ` Mikael Sundqvist via ntg-context
2023-05-01 16:14 ` Stefan Haller via ntg-context
0 siblings, 1 reply; 3+ messages in thread
From: Mikael Sundqvist via ntg-context @ 2023-05-01 15:48 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Mikael Sundqvist
Hi,
On Mon, May 1, 2023 at 5:27 PM Stefan Haller via ntg-context
<ntg-context@ntg.nl> wrote:
>
> Hi all,
>
> I wanted to define a custom math function (similar to log etc.) for
> argmax. However, I wanted to have a small space between "arg" and "max"
> and limits should work properly. I am using a up-to-date LMTX installation.
>
> Without the first constraint it's easy:
>
> > % old way:
> > \definemathcommand[argmax][limop]{\mfunction[argmax]}
> > % new way, discoverd by looking into math-def.mkxl
> > \definemathfunction[argmax]
>
> However, both methods do not work if I want to have "arg\,max" printed
> (error about \endcsname missing). With mkiv the first method works and
> can also be found in the wiki[1].
>
> What's the current way to define such a custom math function?
>
> Thanks!
> Stefan
>
> [1]: https://wiki.contextgarden.net/Math/functions
This works here (but maybe there should be a simpler way):
\definemathfunction
[argmax]
[mathlimits=auto]
\setupmathlabeltext
[en]
[argmax=arg\sixperemspace max]
\startTEXpage[offset=1ts]
\im{
\argmax_{a\in A} f(a)
}
\blank[big]
\dm{
\argmax_{a\in A} f(a)
}
\stopTEXpage
/Mikael
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [NTG-context] define math function with \, inside
2023-05-01 15:48 ` Mikael Sundqvist via ntg-context
@ 2023-05-01 16:14 ` Stefan Haller via ntg-context
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Haller via ntg-context @ 2023-05-01 16:14 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Stefan Haller
Hi Mikael,
On Mon, May 01, 2023 at 05:48:40PM +0200, Mikael Sundqvist via ntg-context wrote:
> [...]
> This works here (but maybe there should be a simpler way):
>
> \definemathfunction
> [argmax]
> [mathlimits=auto]
>
> \setupmathlabeltext
> [en]
> [argmax=arg\sixperemspace max]
> [...]
That was exactly what I was looking for. It is working perfectly. Thanks
a lot!
With this knowledge finding additional information in the wiki is much
easier: :)
1. https://wiki.contextgarden.net/Command/_setuplabeltext
2. https://wiki.contextgarden.net/Command/_labeltext
Stefan
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-01 16:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-01 15:19 [NTG-context] define math function with \, inside Stefan Haller via ntg-context
2023-05-01 15:48 ` Mikael Sundqvist via ntg-context
2023-05-01 16:14 ` Stefan Haller via ntg-context
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox