2

I am making (almost) my first attempt with unicode-math and this is my first use of the STIXTwo fonts. I'm unhappy with the spacing around italic f in math mode. (And with the spacing before italic j in some cases.) I'm using Lualatex (up-to-date TL2021) and STIXTwo fonts from their Github site.

Can I adjust this somehow (in Latex, I have no font editor)? If so, will I need to specify an adjustment for every pair? I found this link, Change kerning for `f'` in math mode , but it did not help. This link (Two letter variable names) suggests that the problem is italic correction, and this one (Ugly spacing around f in math mode) indicates that the problem is with a math-mode bounding box. (Can I adjust that box?)

If it's possible, could someone show me the syntax of how to adjust a pair or two, so that I can go do others? (And if it's possible to just modify f itself or its "bounding box" instead of a bunch of pairs, that would of course be terrific.)

Here's an expression taken from the first link above that I think produces ugly output with unicode-math+STIXTwo:

\documentclass[varwidth,margin=10pt]{standalone}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{STIXTwoText-Regular}
\setmathfont{STIXTwoMath-Regular}

\begin{document}
\[ \frac{2\pi ft}{k} \]
\end{document} 

enter image description here

6
  • 1
    Unrelated: unicode-math loads fontspec, so no need to load it manually.
    – Cicada
    Feb 14, 2022 at 6:18
  • In ConTeXt this is possible via so-called goodie files. I don't know if there is a counterpart for LaTeX. But, are you sure you want to do this? Try for example e_2f^b. There is not too much space to take.
    – mickep
    Feb 14, 2022 at 7:54
  • The more I look at the formula, the more I see the necessity of the italic correction.
    – egreg
    Feb 14, 2022 at 9:11
  • @mickep So it looks like I would need to specify specific pairs, maybe just other letters after and letters and digits before. But is that possible?
    – dedded
    Feb 14, 2022 at 12:31
  • As far as I know, configuring the kerning between specific pairs in math is not doable. But is this the true formula (it looks like the one in the question you linked to), or do you have some other real-life example where it looks worse?
    – mickep
    Feb 14, 2022 at 13:04

1 Answer 1

0

You can kern.

Here I use \!\,:

italic f

I don't have STIX2, but TexGyrePagella shows the same.

MWE

\documentclass[varwidth,margin=10pt]{standalone}
%\usepackage{fontspec}
\usepackage{unicode-math}
%\setmainfont{STIXTwoText-Regular}
%\setmathfont{STIXTwoMath-Regular}
\setmainfont{TexGyrePagella}
\setmathfont{TexGyrePagellaMath}

\begin{document}
\[ \frac{2\pi ft}{k} \]
\[ \frac{2\pi f\!\,t}{k} \]
\end{document} 
8
  • Do texdoc latex2e, "16.6 Spacing in math mode", might help.
    – Cicada
    Feb 14, 2022 at 6:20
  • With a macro solution, I would need to use it every time I use an f. I was hoping I could set something up once and get it over with.
    – dedded
    Feb 14, 2022 at 12:29
  • Just an aside, you likely have an older STIXTwo available, looks like both Texlive 2020 and 2021, at least, came with it: texlive/2021/texmf-dist/fonts/opentype/public/stix2-otf/STIXTwoMath-Regular.otf
    – dedded
    Feb 14, 2022 at 12:35
  • Latex2e manual says: One advantage of these commands is that they automatically insert italic corrections if needed (see Section 19.9 [\/], page 163). Specifically, they insert the italic correction unless the following character is in the list \nocorrlist, which by default consists of a period and a comma. To suppress the automatic insertion of italic correction, use \nocorr at the start or end of the command argument, such as \textit{\nocorr text} or \textsc{text \nocorr}. and There is no concept of italic correction in math mode; spacing is done in a different way.
    – Cicada
    Feb 15, 2022 at 1:02
  • Would redefining unicode-maths \mitf macro be worthwhile: \UnicodeMathSymbol{"1D453}{\mitf }{\mathalpha}{mathematical italic small f}% (unicode-math-table.tex line 1535), or maybe defining a new symbol instead? However, some correction must be needed for italic f anyway, because of its lean: that is, see what f{} does.
    – Cicada
    Feb 15, 2022 at 1:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .