# [luatex] sub and superscripts in Lua(La)TeX with tfm/otf

Arno Trautmann Arno.Trautmann at gmx.de
Mon Jun 13 16:31:20 CEST 2016

On 06/13/2016 02:53 PM, Ulrike Fischer wrote:
> Am Mon, 13 Jun 2016 11:35:11 +0200 schrieb Arno Trautmann:
>
>> Hi all,
>>
>> I encountered some strange behaviour regarding the subscript and
>> superscripts in LuaLaTeX compared to pdfLaTeX. Consider the following
>> small example:
>>
>> %\RequirePackage{luatex85}
>> \documentclass{scrartcl}
>> %\usepackage{subdepth}
>> %\usepackage{unicode-math}
>>
>> \begin{document}
>> $a_ia_i^+a^+a_i^\dagger$
>> $M_n M_n^\dagger M_n^+$
>> \end{document}
>>
>> Compilation with pdfLaTeX results in shifted positions for the sub and
>> super scripts according to the TeXbook. The package subdepth equalizes
>> them, which in this case looks nicer.
>> With LuaLaTeX, the subdepth package does not work, and has no effect on
>> the positioning whatsoever. David suggested to ask for a reason for this
>> behaviour on the luatex-list.
>
> As far as I understand the documentation (and the result of some
> font to setup some primitive parameters. If you later want to change
> the values you have to change the primitives and not the \fontdimens
> (as the subdepth package does).
>
> This here works with and without unicode-math and moves one of the
> subscripts n down:
>
> \documentclass{scrartcl}
> %\usepackage{subdepth}
> %\usepackage{unicode-math}
>
> \begin{document}
>
> $M_n M_n^\dagger M_n^+$
>
> \Umathsubshiftdown\displaystyle=5pt
> \Umathsubshiftdown\textstyle=5pt
>
> $M_n M_n^\dagger M_n^+$
>
> $M_n M_n^\dagger M_n^+$
>
> \end{document}
>
> For more parameters see 6.4 Math parameter settings in the luatex
> documentation.

Thank you very much, I had read that section indeed (after posting here
…) and found the following working solution, basically the same as yours:

\documentclass{minimal}
\begin{document}
$M_n M_n^\dagger M_n^+$

\Umathsubshiftdown\displaystyle=2.84pt
\Umathsubsupshiftdown\displaystyle=2.84pt
\Umathsubsupvgap\displaystyle=1pt

$M_n M_n^\dagger M_n^+$
\end{document}

One question remains here (besides asking the authors of subdepth to
adapt the package to LuaLaTeX if possible) – When I try to apply the
\Umath... settings before the first equation, they are ignored. So
setting them in the preamble does not work. In plainLuaTeX, otoh, it works:

\Umathsubshiftdown\displaystyle=2.84pt
\Umathsubsupshiftdown\displaystyle=2.84pt
\Umathsubsupvgap\displaystyle=1pt

$$M_n M_n^\dagger M_n^+$$
\bye