ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mikael Sundqvist via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Mikael Sundqvist <mickep@gmail.com>
Subject: Re: [NTG-context] define math function with \, inside
Date: Mon, 1 May 2023 17:48:40 +0200	[thread overview]
Message-ID: <CAHy-LL8-zYZHd6uG8Dk1BzOnVQ_uUKut1DxFC-C03Uu+n3Kahw@mail.gmail.com> (raw)
In-Reply-To: <ZE_Yi2lsSzEp6Dj9@stha.de>

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
___________________________________________________________________________________

  reply	other threads:[~2023-05-01 15:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-01 15:19 Stefan Haller via ntg-context
2023-05-01 15:48 ` Mikael Sundqvist via ntg-context [this message]
2023-05-01 16:14   ` Stefan Haller 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=CAHy-LL8-zYZHd6uG8Dk1BzOnVQ_uUKut1DxFC-C03Uu+n3Kahw@mail.gmail.com \
    --to=ntg-context@ntg.nl \
    --cc=mickep@gmail.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).