# Automatically Raising Subscripts

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).

-

Here's an emulation of what you'd get by raising the superscript. In the first line the result of

$J_{ne}\bm{\mathsf{J}}_{ne}^{-1}$
$J^{}_{ne}\bm{\mathsf{J}}_{ne}^{-1}$


showing left the bad output and on the right the recommended one; in the second line the emulation of raising the superscript (obtained by pretending that the subscript has zero width and adding a superscript to \mathstrut:

$J_{ne}\bm{\mathsf{J}}_{ne}^{-1}$
$J_{ne}\bm{\mathsf{J}}_{\mathrlap{ne}}{\mathstrut}^{-1}$


Next the two examples embedded in text, in the same order; I've no doubt in choosing the first one (lowering the subscript).

-

Instead of raising the subscript term in the second expression, which will make for an extremely cramped look unless you also raise the superscript term (and risk making the whole expression look top-heavy...), you may want to consider lowering the subscript term in the first expression by placing an empty "atom" -- produced by {} -- in the superscript position. Incidentally, as @egreg points out in a comment, if the superscript term to the second J-expression is taller than the character 1 (and contains, say, <whatever>), it'll be necessary to use \vphantom{<whatever>} instead of {} in the first J-expression in order to force the two subscript terms to be aligned with each other.

\documentclass{article}
\usepackage{bm}
\begin{document}
\dots\ some words $J_{ne}^{} \bm{\mathsf{J}}_{ne}^{-1}$ more words \dots
\end{document}

-
No phantom is necessary, just ^{} will do. – Andrew Swann May 30 '13 at 11:59
A phantom might be needed for some bigger superscript to the second symbol. – egreg May 30 '13 at 12:37