I'm running into an issue when using boxes in subscripts with unicode-math loaded.
I drafted the following MWE from my package actuarialsymbol. [Command \qx below puts subscripts on both sides of a symbol; the subscripts should be bottom aligned.]
\documentclass{article}
\usepackage{unicode-math}
\makeatletter
\def\qx[#1]#2{
\fboxsep=0pt % for debugging purposes
\setbox\@ne\hbox{$\scriptstyle{#1}$}
\setbox\thr@@\hbox{$\scriptstyle{#2}$}
\ifdim \ht\@ne>\ht\thr@@
\ht\thr@@=\ht\@ne
\else
\ht\@ne=\ht\thr@@
\fi
\vphantom{q}\sb{\fbox{\box\@ne}}%
q\sb{\fbox{\box\thr@@}}%
}
\makeatother
\begin{document}
$\qx[t]{x}$
\end{document}
When compiling with xetex, the t and x on either side of q are at different heights:
Commenting out unicode-math, the subscripts are at the same height, as I would expect and as it works with pdftex:
Adding \the\ht\thr@@ or \the\ht\@ne before symbol building solves the positioning issue (but is clearly not a viable solution). Removing the call to \vphantom also solves the positioning issue.
I see in the documentation of unicode-math that there is some treatment of subscripts in unicode-math with xetex, but I'm honestly at lost as to what I might be doing wrong or how I should fix the issue.
Placement of subscripts using unicode-math. Is it XeTeX bug? seems closely related to my issue, but alas nothing there helped.




\textstyleinside\vphantomin the macro seems like an entirely satisfactory solution. I can confirm it solves the issue. – Vincent Goulet Jun 14 '17 at 15:30$p_x$and$p_x^2$have their subscript at the same height withxetexandunicode-math. Probably related to the bug you link to, although I get this behaviour with TL 2017. – Vincent Goulet Jun 14 '17 at 18:53