[Tex/LaTex] Why is the fraction off the math axis in XeTeX

fontsmath-modeunicodeunicode-mathxetex

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.

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

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”.

\documentclass{standalone}
\usepackage{unicode-math}
\begin{document}
$-\frac{1}{2}$
\end{document}

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.

Best Answer

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