In my mathematics writing, I often use both superscripts and subscripts on the probability operator. The subscripts are generally lengthy, and I would like for them to appear underneath the operator, which is the default behavior in displaystyle. The superscripts are often just a single number, and I would like them to appear as a superscript (not above the operator), which is the default behavior in textstyle. If I write something like
$$\Pr_{long subscript}\textstyle{^2}$$
I get the behavior I want, but the superscript 2 appears very far to the right because the subscript is so long. If I write instead
$$\Pr\textstyle{^2}_{long subscript}$$
the superscript looks fine, but the long subscript displays as a textstyle subscript (not underneath the operator as I would like).
How can I get the long subscript to display underneath the operator and the superscript to display as a textstyle superscript immediately next to the operator?
\textstyle
is not a macro that takes a argument that is set into text style but a switch. In your examples, text style is still active after{^2}
. Also, if you replace\textstyle
with{}
, you will get the same effect. The\textstyle
does not only activate the text style, it disconnects the superscript (and the subscript in the second example) from the operator, meaning, you could also use\displaystyle
to get the same effect. Just grouping^2
has the same effect.\[
…\]
preferable to$$
?