# Equal positioning of subscripts in Luatex

please look at the following code. I try to get the same position for all subscripts, but there are still some problems:

I get the same position of subscripts at Point (C) when I use \setmathfont at (B). When I do this at (A) the positions of the subscripts are different. What is happening here?

The other Problem: When I change the fontsize, the positions are different, too.

Has anybody an idea how to solve the Problems? What I look for are same positions of ALL subscripts in ALL fontsizes.

\documentclass{article}

\usepackage{unicode-math}
%\setmathfont[math-style=upright]{Tex Gyre Pagella Math}% (A) does not influence the positioning of subscripts

\makeatletter \check@mathfonts \makeatother
\edef\shiftdown{\the\Umathsubsupshiftdown\displaystyle}
\edef\shiftup{\the\Umathsupshiftup\displaystyle}

\makeatletter
\AtBeginDocument%
{\check@mathfonts%
\Umathsubshiftdown\displaystyle=\shiftdown
\Umathsupshiftup\displaystyle=\shiftup
\Umathsubsupshiftdown\displaystyle=\shiftdown}
\makeatother

\setmathfont[math-style=upright]{Tex Gyre Pagella Math}% (B) works for normalsize

\begin{document}

Normalsize (works if the math font is loaded at (B)):
$x³ \, x_{3}^{3} \, x_{3}$% (C)

Huge (ugly):
\Huge
$x³ \, x_{3}^{3} \, x_{3}$% (D)

\end{document}


Or is there another, more efficient way to achieve this?

Thank you.

• Changing \Umathsubshiftdown is okay locally, but for a permanent change you should better patch the math constants table. See e.g. here tex.stackexchange.com/a/385767/2388 – Ulrike Fischer Sep 6 '17 at 19:30
• Oh, I see. But I do not understand anything there. Does a documentation exist? – Weißer Kater Sep 8 '17 at 22:20

\Huge
$x_{3}^{3} \, x_{3}^{\phantom{3}} \, x_{3}$% (D)