# Superscript inside subscript in math mode

When a superscript is placed inside a subscript, its relative position to the "base" becomes different, as shown by the following MWE:

\documentclass{article}
\usepackage{amsmath}

\newcommand\inset{L^-}

\begin{document}

$\inset \text{ vs. } \int_{l \in \inset}$

\end{document}


I was wondering if there is a way to define the macro so that it looks the same in subscripts?

• In the latter case, the symbol occurs in "cramped" scriptscript style; in the former, it occurs in non-cramped script style. The solution consists of forcing non-cramped script style for the latter case. – Mico Mar 31 '18 at 1:29

By default, the superscript-- symbol is in "cramped scriptscriptstyle" in the second example, but in (non-cramped) scriptstyle in the first. To change the second case to the non-cramped style, add a \scriptstyle directive ahead of l\in\inset.

\documentclass{article}
\usepackage{amsmath}
\newcommand\inset{L^{-}}
\begin{document}
$\inset \text{ vs.\ } \int_{\scriptstyle l\in\inset}$
\end{document}


Use \vphantom{x} as a virtual subscript for L and you are good.

\documentclass{article}
\usepackage{amsmath}

\newcommand\inset{L^-}
\newcommand\insetv{L_{\vphantom{x}}^{-}}

\begin{document}

$\inset \text{ vs. } \int_{l \in \insetv}$

\end{document}

• not quite the same. the insertion of the \phantom causes the superscript to shift ever so slightly to the right. try placing the phantom subscript after the superscript. – barbara beeton Mar 31 '18 at 1:11