I cannot get my superscript to stagger after the subscript

Here is an example of superscripts staggering after subscripts with the amsmath package:
{x_\text{P}}^2.
But in this case they do not stagger:
{\bar{x}_\text{P}}^2

How can I get staggering similar to my first example?

• Don't use \text to begin with, but \mathrm. The correct way is {{}\bar{x}_{\mathrm{P}}}^2 (assuming you really want the superscript to hang from nowhere. Nov 22 '17 at 23:46
• This is essentially the same as tex.stackexchange.com/questions/125165 but with superscript instead of subscript. Nov 22 '17 at 23:49

This is almost the same as Can I have a dot and a double subscript at a single letter?

\documentclass{article}
\usepackage{amsmath}

\begin{document}

${x^{}_{\mathrm{P}}}^2$ ${{}\bar{x}^{}_{\mathrm{P}}}^2$

\textit{Spot the difference $x_{\text{P}}\ne x_{\mathrm{P}}$}

\end{document}


One needs an empty atom in order the stripping of outer braces around a single Acc atom is not performed.

I find the staggered superscript to be hanging from nowhere and I'd avoid it.

By the way, you should use also an empty superscript in order to move the subscript down. And \mathrm{P} instead of \text{P}. Notice also the extra braces.

• not able to test, but seem to remember that "tensor" strings of subs and sups could be offset as a_b{}^c{}_d{}e. should be an example in the texbook. Nov 23 '17 at 0:47
• @barbarabeeton: Yes, it’s Exercise 16.6 on p. 130; another example is on p. 169. Look up “tensor notation” in the index.
– GuM
Nov 23 '17 at 0:53
• What is the advantage of the extra braces around \mathrm{P}? Nov 23 '17 at 1:01
• @DavisRash The difference is between correct syntax versus a construct that works by chance. Nov 23 '17 at 9:05