# Superscript placement using unicode-math with scaling

When I scale up a math font using the unicode-math package, the placement of the superscript is too low. How can I globally adjust the placement of superscripts for this scaled math font?

\documentclass{article}

\usepackage{unicode-math}
\setmathfont[Scale=1]{latinmodern-math.otf}

\begin{document}

$\nu_e + \beta^+$
\setmathfont[Scale=2.8]{latinmodern-math.otf}
$\nu_e + \beta^+$

\end{document}

• The placement is low in luatex but raised as expected in xetex – David Carlisle Mar 10 '15 at 10:36
• It doesn't matter whether you scale the font inside the document or load it scaled to begin with. – egreg Mar 10 '15 at 11:59
• Issue raised: github.com/wspr/unicode-math/issues/287 – egreg Mar 10 '15 at 16:20

It's a bug in unicode-math-luatex: if you try

\documentclass{article}

\usepackage{unicode-math}
\setmathfont[Scale=2.8]{latinmodern-math.otf}

\begin{document}

$\nu_e + \beta^+$

\end{document}


you get

with LuaLaTeX, while you get the expected

with XeLaTeX.

If I add \showthe\Umathsupshiftup\displaystyle in the formula, I get 3.62994pt with LuaLaTeX and \showthe\fontdimen13\textfont2 gives 3.63pt with XeLaTeX.

When I use \showlists, the box where the superscript is typeset is

.\hbox(11.42676+1.6268)x15.80873, shifted -3.62994, direction TLT
..\EU2/latinmodern-math.otf(0)/m/n/6.99997 +


with LuaLaTeX, while it is

.\hbox(11.42676+1.6268)x15.74875, shifted -10.16402
..\EU1/latinmodern-math.otf(0)/m/n/6.99997 glyph#12


with XeLaTeX. Since

10.16402/2.8 = 3.63001


the conclusion is that LuaLaTeX doesn't apply the scaling to the math font parameters,

Notice that this seems restricted to superscripts, because the box with the subscript is

.\hbox(8.66316+0.2156)x13.82913, shifted 5.22322, direction TLT
..\EU2/latinmodern-math.otf(0)/m/n/6.99997 𝑒


in LuaLaTeX and

.\hbox(8.66316+0.2156)x13.76915, shifted 6.916
..\EU1/latinmodern-math.otf(0)/m/n/6.99997 glyph#1354


with XeLaTeX; still a difference, but much less noticeable (XeLaTeX seems wrong in this respect, because it seems to assume the presence of a superscript; the placement is the same if \nu^{}_e is used).

It doesn't seem to depend on the font, because the same problem shows with XITS Math or Asana Math.

If I use

\documentclass{article}

\usepackage{unicode-math}
\setmathfont[Scale=2.8]{latinmodern-math.otf}

\makeatletter
\AtBeginDocument{%
\check@mathfonts
\Umathsupshiftup\displaystyle=10.16402pt
}

\begin{document}

$\nu_e + \beta^+_{}$

\end{document}


the output is correct

Of course this is just a hack.

• isn't that more of a comment than an answer? (at least, it's same as my comment:-) – David Carlisle Mar 10 '15 at 11:54
• @DavidCarlisle Trying to make a sense out of the parameters – egreg Mar 10 '15 at 11:56
• Nice @egreg. One question: what does the command \check@mathfonts do? – Steven Gardiner Mar 10 '15 at 16:11
• @StevenGardiner It ensures the assignments of fonts to math groups is up-to-date with the current font size. – egreg Mar 10 '15 at 16:14
• As of unicode-math v0.8m, the output is wrong with XeTeX, too. – Ruixi Zhang Jan 21 at 17:35