The fraction in textstyle is off the math axis in XeTeX when I use a Unicode math font. In LuaTeX, though, it aligns nicely with the math axis. The follwing MWE should illustrate this. Also, in displaystyle everything is fine.

  \input luaotfload.sty
$-{1\over 2}$%
\font\ms="Latin Modern Math:script=math;+ssty=0" at 7pt
$-{1\over 2}$

Here you can see the output for XeTeX and LuaTeX:

enter image description here

enter image description here

How can I fix this? Does it suffice to adjust \fontdimen parameters?

This does not only happen in plain XeTeX, but also in LaTeX with the unicode-math package. Unfortunately, I cannot show a side-by-side comparison here, because unicode-math immediately changes the math font to “Latin Modern Math”.


enter image description here

enter image description here

As can be seen from Herbert's reply, the problem also occurs in other situations. Here I collect an incomplete list of questions reporting similar issues:

Unfortunately, the problem was not entirely fixed and messed up fontdimens still turn up in some places.

  • There's evidently some problem in computing the \fontdimen parameters. – egreg Dec 4 '15 at 15:57
  • The at 7pt seems to scale the fontdimen (try out 3pt for a more pronounced effect). – Ulrike Fischer Dec 4 '15 at 16:19
  • @egreg Which \fontdimen is responsible for that? I can only find ones for raising or lowering numerator and denominator but none for the bar or axis. Also setting, e.g., \fontdimen42\scriptfont0=10pt does not seem to have any effect. – Henri Menke Dec 5 '15 at 12:24
  • I think this is a good one for the XeTeX mailing list at tug.org/mailman/listinfo/xetex. It seems that XeTeX is using \fontdimen22 pertaining to \scriptfont2 instead of \textfont2. – egreg Dec 6 '15 at 13:54
  • IIRC, there's a difference between lua +ssty (scriptstyle!) and xetex; ie for lua: 2 and xetex: 1 or something – morbusg Aug 9 '16 at 13:00

This seems to be fixed in the development version of XeTeX (looks like it was the same underlying issue as \setbox containing maths interferes with surrounding math mode in XeTeX):

enter image description here

  • This is great news! I'll mark your answer as accepted once TL 2017 is released which will probably contain the fixed version. – Henri Menke Oct 7 '16 at 18:18
  • 1
    Was it you who fixed this bug? The person who corrected this deserves a reward I think. – Henri Menke Oct 7 '16 at 18:19
  • 4
    @HenriMenke: Jonathan Kew fixed it (and a few other math bugs). It was me, however, who introduced this bug in the first place, so I guess this makes me deserve the reverse of being rewarded. – Khaled Hosny Oct 7 '16 at 20:57
  • 1
    Don't worry :) Can you maybe point me to the corresponding diffs and commits in the code? I'd like to study in detail what was wrong. – Henri Menke Oct 7 '16 at 21:11
  • 2
    @HenriMenke: I’m not 100% sure which commit fixed it, but my guess is this one. – Khaled Hosny Oct 7 '16 at 23:50

I played a bit ... black is xelatex and red lualatex and yes, this is not an answer ...


enter image description here

  • 5
    Ugh… I used this approach to test luatex, xetex, and pdftex against Knuth tex and it turned out that tex, pdftex, and luatex overlay exactly, whereas xetex is off, as shown in your picture. That is to say, that math typesetting with Unicode math fonts is inherently broken in XeTeX. – Henri Menke Dec 6 '15 at 14:19
  • 1
    After some more playing, I found that this is also related to the “at 7pt”. For some reason even the spacings between the math atoms are scaled by that factor. But even after that there is a small difference left, cf. gist.github.com/anonymous/75e5b006effae7d3b860 – Henri Menke Dec 6 '15 at 15:06

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.