[Tex/LaTex] Superscript and subscript together in text mode


I want to use super and subscript at the same time in text mode. I cannot use math mode because I created macros which only work in text mode.

I found this question: Vertically aligning textsuperscript and textsubscript together

But the suggested answer does not work because the width of the resulting text is based only on the subscript, if the superscript is longer the text overlaps with the content afterwards.

I created the following versions for longer sub / superscripts but i need them combined:




prefix\SPSBbottom{long}{1}text \\[1cm]
prefix\SPSBbottom{1}{long}text \\[1cm] % Working combination
prefix\SPSBtop{long}{1}text \\[1cm] % Working combination
prefix\SPSBtop{1}{long}text \\[1cm]


If I could place two text at the same place and the width is taken from the longer one than using \textsuperscript{#1 'and' \phantom{#2}}\textsubscript{#2 'and' \phantom{#2}} could work but I do not know how to do this.

Alternatively one could use the math form $A^{top}_{bottom}$ where top and bottom are in a nested normal mode (\text{} does not work). But I found no way to do this as well.

Thanks in advance 🙂

Best Answer

Duplicate the definition of \textsuperscript:






Add \strut to the second argument if you prefer.

enter image description here

Related Question