Superscript outside math mode

You can use \textsuperscript{th}. It sets its contents in text mode and can be used in math or text mode.


For 99% of applications, Werner's answer is good enough. But since Marienplatz has offered a bounty, there presumably is interest in other ways to do this. So here, I show it done with a stack over a null entry. My preamble definition (output on the second line) appears to give the exact same result as \textsuperscript (output on the first line).

But then, I show how both the size of the script as well as the height of it can be simply changed with my stacking approach, shown in \footnotesize (and lowered) in the 3rd line of output, and in \tiny (and raised) in the last line.

While I stick just to the standard text font sizes, it would be trivial to instead use a \scalebox to get exactly the size of script text desired.

If there is a desire to place the script, not at a fixed elevation, but relative to the height of the character being scripted, that is easy too (just ask).

\documentclass{article}
\usepackage{stackengine}[2013-10-15]
\newcommand\textss[1]{\stackengine{.9ex}{}{\scriptsize#1}{O}{l}{F}{F}{L}}
\begin{document}
\noindent
a\textsuperscript{th}A\textsuperscript{th}\\
a\textss{th}A\textss{th}\\
\renewcommand\textss[1]{\stackengine{.7ex}{}{\footnotesize#1}{O}{l}{F}{F}{L}}
a\textss{th}A\textss{th}\\
\renewcommand\textss[1]{\stackengine{1ex}{}{\tiny#1}{O}{l}{F}{F}{L}}
a\textss{th}A\textss{th}\\
\end{document}

enter image description here


The old-school solution:

29\raise0.5ex\hbox{th}

(TeXbook, Chapter 11)

Tags:

Superscripts