I would like to typeset formulas including "midscripts" - like subscripts and superscripts, but in the middle. This question and answer gives some solutions: Subscript. Superscript. Middlescript? . However, I would like to be able to combine midscripts, superscripts and subscripts for the same symbol. Additionally, I would like them to be horizontally centered, and maybe even occasionally right-aligned (it turns out that I am using not only middlescripts, but left middlescripts).
A partial solution is to simply write something like
$\begin{smallmatrix}i // j // k\end{smallmatrix} X$ ; this takes care of the horizontal centering. This looks nice enough when all three indexes are present. However, if one of them is missing - e.g.
$\begin{smallmatrix}i // j // \end{smallmatrix} X$ , the vertical alignment is broken: the j should be a midscript, but is now hanging so low that it could be mistaken for a subscript.
Is there a way to produce a similar result but in such a way that the middle line of the index stack always has a consistent, more or less centered vertical position, regardless of whether the top and bottom lines are there and of how tall or short they are?
I do not insist on using smallmatrix: maybe the right answer involves \overset, \substack, an ordinary matrix or array combined with \scriptstyle, or something entirely different. Any solution is acceptable, as long as it allows horizontal centering (or right-alignment) and does not introduce excessive horizontal spacing between the main symbol and its indexes.
