I find that inline fractions with the Stix Two fonts are a bit too tall, pushing the baselines apart. So I want to shrink them down a little. In principle, I know how; see below.
The problem is that the parameters get reset after a change in font size, even if the size change is local to a group. MWE:
\documentclass{minimal}
\usepackage{fontspec,unicode-math}
\setmathfont{STIX2Math.otf}
\begin{document}
$\frac12$\quad
\Umathfractionnumup\textstyle=5pt
\Umathfractiondenomdown\textstyle=5pt
$\frac12$\quad
{\fontsize{8pt}{9pt}\selectfont$\frac12$}\quad
$\frac12$
\end{document}
The output is as follows.
The second fraction is what I wanted (more or less). But as you can see from the fourth one, parameters are back to standard after the smaller fraction has been typeset. So it seems that I need to hook into something to repeat the relevant settings somehow. I can set these parameters from lua as well, but I have been unable to find a suitable hook. In particular, setting this in luaotfload.patch_font does not cure the problem.
Yes, I could try to use \everymath, but that is prone to being overwritten by other stuff. Or maybe not. I'll try it if desperate, but it does not seem like a sufficiently robust solution.
Also, I wonder if this behaviour is the expected one? It does seem to make life difficult.



\fracitself. But it seems inelegant. – Harald Hanche-Olsen Aug 10 '17 at 13:12