# [NTG-context] Changing font for math function

Hans Hagen pragma at wxs.nl
Sat May 16 17:35:16 CEST 2015

On 5/16/2015 4:23 PM, Maggyero wrote:
>  > By default, in all three formats the font for \log is mathupright rather
>  > than textrm. There needs to be a rationale for ConTeXt default to be
>  > different from other formats. Do you have any reference to a math
> book or
>  > journal that uses text fonts for \log-like operators?
>
> Thanks for the examples. I had forgotten that math fonts can differ from
> text fonts. Now I understand why you use \mathupright (which, according
> to the source code is identical in math mode to \mathrm and \rm). And I
> know that math fonts have different kerning and ligatures than text fonts.
>
> But how is that in LaTeX, kerning and ligatures in math mode inside
> \mathrm are the same as those of the TEXT font (while in ConTeXt \mathrm
> still uses the kerning and ligatures of the math font, which seems
> logical)? Compare the following:
>
> LaTeX:
>
> \documentclass{article}
>
> \begin{document}
> affinity\par
> $\mathrm{affinity}$\par % kerning and ligatures of TEXT mode with math font
> \end{document}
>
> ConTeXt:
>
> \starttext
> affinity\par
> $\mathrm affinity$\par % kerning and ligatures of MATH mode with math font
> \stoptext

I have no clue how latex implements it (and don't care much either) but
in context we use a unicode approach and \mathrm switches to another
math alphabet ... in fact, affinity is just a sequence of a f f i n i t
y (symbols, variables, whatever) and not a real word. You can use
\text{affinity} but of course all depends on what the font setup is (and
if your bodyfont has the same shapes for math and text).

Bottom line: if you switch to \mathrm etc you don't switch fonts of
styles, you switch to another alphabet. One can of course map these
internally onto some text font but context doesn't work that way.

Hans

-----------------------------------------------------------------