Vertically aligning textsuperscript and textsubscript together
without using directly math and with colors:
\documentclass{article}
\usepackage{fixltx2e}
\usepackage{xcolor}
\def\SPSB#1#2{\rlap{\textsuperscript{\textcolor{red}{#1}}}\SB{#2}}
\def\SP#1{\textsuperscript{\textcolor{red}{#1}}}
\def\SB#1{\textsubscript{\textcolor{blue}{#1}}}
\begin{document}
\huge
sometext\SPSB{1}{2} more text
sometext\SP{1} more\SB{2} text\SP{1}
\end{document}
use it in math mode, digits are always set in upright mode.
\documentclass{article}
\usepackage{fixltx2e}
\begin{document}
\Huge
sometext\textsuperscript{1}\textsubscript{2}
sometext$^1_2$ \qquad$^1_2$sometext
\end{document}
Math mode:
sometext$^1_2$
or (with amsmath
):
$\text{sometext}^1_2$