I have the following expression
J_{ne}\boldsymbol{\mathsf{J}}_{ne}^{-1}
which is awkward in the sense that as the second (sans-serif) J has a superscript that the subscripted indices are lower than usual. Using the subdepth package has the effect of aligning the indices by lowering them even in the absence of a superscript. However, I would prefer to raise the subscripts which have been lowered by the presence of a superscript.
Although How to raise a subscript? describes how one can accomplish this it requires knowing the specific amount to raise the relevant subscripts by. Ideally, I am looking for an automatic way of accomplishing this (albeit one that only needs to work for the specific case outlined above as opposed to arbitrary sub/superscripts).



mathrlapis not defined, even when importing thesubdepthpackage. You need\usepackage{mathtools}, it seems. But even then, the final approach breaks horizontal spacing if the subscript is longer than the superscript. This can be fixed by repeating the subscript withhphantom. I ended up using{{J}_{\mathrlap{SUBSCRIPT}}{\mathstrut}^{\v{SUPERSCRIPT}}_{\hphantom{SUBSCRIPT}}}– MRule Jun 01 '22 at 11:01