[NTG-context] Multi-letter words/identifiers in math

Hans Hagen j.hagen at xs4all.nl
Mon Sep 30 15:22:41 CEST 2019

On 9/29/2019 9:30 AM, Shuxian Wang wrote:
> Dear list,
> I am trying to typeset some multi-letter words/identifiers in 
> mathematical formulas. Currently, doing things like |{\it variable}| or 
> |{\mathit variable}| under math mode will cause the engine to shift all 
> characters into the corresponding unicode mathematical alphanumeric 
> block position. However, most OpenType fonts that have good support for 
> unicode math are optimized for single-character usage. Therefore, the 
> outcome of such method is non-ideal, as no kerning or ligatures will be 
> enabled. Especially, this gives bad output when typesetting variable 
> names with combinations like “ffi”.
> Looking through some past discussions on the list, I am aware of the 
> usage of |\mathword| and |\mathtext|. Using those command will keep all 
> the characters “as is” and typeset them under text mode (as far as I can 
> tell). But those commands switch to the main body fonts temporarily to 
> accomplish this. Sometime when using a different math font than the main 
> font (like Palatino with Latin Modern Math), I wish my variable names 
> can also be in the math font (or at least very similar, such as Latin 
> Modern vs. Latin Modern Math) to better merge with the formula.
> The way I am currently doing is to introduce some “math text fonts” that 
> is different from the main text font but close to the math font. And 
> with custom font switchers like |\mwrm| and |\mwit| to help me define 
> things like
> |
> \def\wordrm#1{\mbox{\mwrm #1}}
> \def\wordit#1{\mbox{\mwit #1}}
> |
> Am I missing some builtin functionalities or easier ways to do this? If 
> not, would it be a good idea to extend the functionality of |\mathword| 
> so it lifts out the restriction of only using the main text font?
maybe \mfunction{...} is what you are looking for

                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl

More information about the ntg-context mailing list