17

Consider the following MWE:

\documentclass{article}
\RequirePackage{fontspec,unicode-math}
\setmainfont{STIX Two Text}
\setmathfont{STIX Two Math}
\begin{document}
\showboxbreadth\maxdimen
\showboxdepth\maxdimen
$\gamma_{e}\ne\gamma_{\mathrm{e}}\showlists$\showlists
\end{document}

It produces this output with LuaLaTeX:

enter image description here

As you can see, the two subscripts are placed differently.

The first \showlists contains no surprises:

### math mode entered at line 8
\mathord
.\fam0 𝛾
_\fam0 𝑒
\mathrel
.\fam0 ≠
\mathord
.\fam0 𝛾
_\fam4 e

But the second one does:

\mathon
\TU/STIXTwoMath(1)/m/n/10 𝛾
\kern-1.5
\hbox(3.6254+0.09818)x3.85008, shifted 2.09998, direction TLT
.\TU/STIXTwoMath(1)/m/n/7.01236 𝑒
\glue(\thickmuskip) 2.77771 plus 2.77771
\TU/STIXTwoMath(1)/m/n/10 ≠
\penalty 500
\glue(\thickmuskip) 2.77771 plus 2.77771
\TU/STIXTwoMath(1)/m/n/10 𝛾
\hbox(3.401+0.07013)x3.65373, shifted 2.09998, direction TLT
.\TU/STIXTwoText(1)/m/n/7.01236 e
\mathoff

Note the \kern-1.5, which tucks the subscript in under the gamma character on the left side, and the absence of a similar kern on the right side.

Why is this happening?

Edit: As egreg notes, this appears to be related to fonts – i.e., that the subscript comes from the text font and not the math font. Replacing \mathrm{e} by \symrm{e} cures it, in this case. However, if the subscript is a word, like “ess” or “disc”, this is not a good option, as the interletter spacing in the subscript is then wrong. Here is a workaround for that:

\Umathchardef\zwspace="0"0"200B
...
$\gamma_{\zwspace\mathrm{ess}}$

which adds a zero-width space from the math font as an ordinary math atom at the beginning of the subscript, allowing the normal subscript placement to take place. This has one shortcoming: If the next character is tall, that is not taken into account, and the subscript could be too far to the left.

I have reported this problem to the luatex list, and will report back here if I have some news from them.

10
  • You should ask on the luatex list; if I compile with XeLaTeX, the kern is added also in the second case.
    – egreg
    Apr 10, 2018 at 12:13
  • 1
    On the other hand, if you use \symrm{e}, the kern is added also with LuaLaTeX. I guess it has to do with different fonts used.
    – egreg
    Apr 10, 2018 at 12:16
  • I get no kern at all. Which tex system and which version of the fonts are you using? OK: I see it with TL17 but not TL18. Apr 10, 2018 at 12:21
  • @UlrikeFischer I am on the latest (frozen) TL2017 on a mac. The STIX Math font is Version 2.00 b137 (according to otfinfo). Apr 10, 2018 at 12:24
  • I just edited my comment: I see it on TL17 but not on TL18. Apr 10, 2018 at 12:25

1 Answer 1

4

Apparently, this has been fixed in the upcoming LuaTeX 1.08. (Source: Ulrike Fischer in chat.)

So it really seems to have been a LuaTeX bug (or at least, misfeature).

2
  • It's actually a font bug, because some fonts behaved properly (at least in ConTeXt). Apr 22, 2018 at 0:50
  • 1
    @HenriMenke And let the finger pointing begin. :-) No, seriously, I don't understand the issue well enough to contradict you, so you may well be right. But apparently LuaTeX 1.08 gets it right, so either the engine is now working around what is a font bug, or else the story is a bit more complicated than that. (My own report to the luatex list elicited no response, and even your message on the ConTeXt list resulted in a rather terse answer. So I am still fumbling in the dark here.) Apr 22, 2018 at 7:44

You must log in to answer this question.

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