# [NTG-context] Changing font for math function

Tue May 12 20:05:37 CEST 2015

On Tue, 12 May 2015, Maggyero wrote:

>> Hans Hagen wrote:
>> for functions one can now use:
>> \setupmathematics
>>   [functionstyle=\rm]
>
> Fantastic! Thank you Hans, it is way better than the old mechanism
> \setmathfunctionstyle. Now I have a few suggestions to improve the
> consistency of this new mechanism. First, I think this functionstyle key
> a) should be better called 'mathlabelstyle';

No. The style applies to anything called using \mfunction{...}, so
functionstyle and functioncoloar are appropriate keys.

> b) be default to \tf to make the FONT ALTERNATIVE always upright;

I disagree. The default should be \mathupright (as is the case in amstex
and latex, and probably also plaintex). We now have the option to change
it to \tf if desired.

> c) be linked to this following new definition in math-ini.mkiv:
>
> + \unexpanded\def\mathlabel#1{\text{\mathlabelstyle #1}}
>
> so that \mathlabel can be used for labeling math objects like functions but
> ALSO for labeling variables with subscripts (e.g., \rho_{\mathlabel{air}}).
> The hardcoded \text in the definition of \mathlabel is used here for these
> 5 reasons:

> That \mathlabel should replace \mfunction which should be removed, and
> \mfunctionlabeltext should be removed as well and one should directly use

I strongly disagree to this. These are two completely different issues
(wanting a macro to tag multiletter variable names vs a macro to tag
log-like operators).

> 1. Every command containing the word 'labeltext' should not have a style
> attached to it.
> 2. The word 'function' is misleading because \mfunction and
> \mfunctionlabeltext do not create a \mathop atom and it makes the user
> believe its usage is restricted for labeling functions while the command
> should also be used for labeling variable with subscripts (e.g.,
> \rho_{\mathlabel{air}} is far better than \rho_\mfunction{air}).
> 3. Using only \mathlabeltext with \setuplabeltext is also more consistent
> with the current \labeltext that works with \setuplabeltext.
>
> Thus the function definitions in math-def.mkiv should be changed:
>
> - \definemathcommand [arccos]  [nolop] {\mfunctionlabeltext{arccos}}
> + \definemathcommand [arccos]  [nolop] {\mathlabel{\mathlabeltext{arccos}}}
> etc.

I don't see the rationale for this.

> And I think you should add in this file the definition of the differential
> operator which is so widely used in mathematics, so that users have at
> their disposal once for all a proper implementation of this operator and
> don't have to make their own hack:
>
> + \definemathcommand[diff]{\mathop{\mathlabel{d}}\mathopen{}}

Note that there is no consensus on how the d in calculus should be
typeset. There are also \differentiald and \differentialD that map to
unicode slots.

> \definemathcommand[arsinh][nolop]{\mathlabel{arsinh}}
>
> \starttext
> $\arsinh z = \ln\bigl(z + \sqrt{z^2 + 1}\bigr)$\par
> $\rho_{\mathlabel{air}} = \frac{p}{R_{\mathlabel{specific}}T}$\par
> \stoptext