I would like to use KpMath as my main math font, but also to use the letters and numbers from usual Palatino to match my main text. For this purpose, I replaced the letters and numbers from the font texgyrepagella-math.otf. However, in doing so, the space before the letter f becomes too small:

enter image description here

which should be like

enter image description here

Of course I can fix this in my document by manually add a \, before each letter f. However, it would cause a lot of trouble if one wishes to change the font afterwards. Is it possible to simply modify this spacing?

Below is a MWE.




\setmathfont { KpMath-Regular.otf }
\setmathfont { texgyrepagella-math.otf }
    range = { it / { Latin, latin }, bfit / { Latin, latin }, up / num, bfup / num }
\setmathfont { KpMath-Regular.otf } [ range = {} ]



\( (f) \)

\( f_i f_j \)

\( 123 \)

  • Looks like a design choice with all the texgyre math fonts - luacode can rewrite the kerning and substitution tables, if that helps (until if/when the fonts are updated...?).
    – Cicada
    Jul 9, 2022 at 15:26
  • @Cicada How should one do this for a math font? The only example I've seen is Ulrike Fischer's code for usual text font, where the character before can only be a letter; but with math font the previous content could be subscript, brackets and other types, which seems much complex.
    – Jinwen
    Jul 9, 2022 at 17:54
  • Complex, yes. For clarity and scope, ask a separate question so more eyes are on it. TeXbyTopic has four chapters on math, and chapter 7 of luatex.pdf looks useful for lua code. Mix-and-match of fonts is basically entering font-design space, and math mode is totally different to text mode, so big topics, hence specific scope required would be helpful to get an answer.
    – Cicada
    Jul 10, 2022 at 7:49


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.