Superscript and subscript in text in LaTeX (textsuperscript, textsubscript)

\textsuperscript{...} raises text and \textsubscript{...} lowers it, both in the font of the surrounding text and without math mode.

Superscript

The argument is set smaller and raised. Use it for ordinals, abbreviations and marks.

The 1\textsuperscript{st} and the 2\textsuperscript{nd} place,
M\textsuperscript{me} Dupont, Product\textsuperscript{TM}
Result
The compiled example

Open in the editor

Subscript

\textsubscript is part of LaTeX since 2015. Older installations need the fixltx2e package for it.

H\textsubscript{2}O, CO\textsubscript{2} and a value of x\textsubscript{max}
Result
The compiled example

Open in the editor

Why not math mode

$^{th}$ sets the letters in the italic math font, as a product of the variables t and h. \textsuperscript{th} uses the text font and its letter spacing.

Text font: 10\textsuperscript{th}. Math font: 10$^{th}$.
Result
The compiled example

Open in the editor

Units and chemical formulas

For square metres and for formulas such as CO2, the packages siunitx and mhchem raise and lower the characters themselves.

Complete document:

\documentclass{article}
\usepackage{siunitx}
\usepackage[version=4]{mhchem}
\begin{document}
A room of \qty{25}{\square\metre} and a bottle of \ce{CO2}.
\end{document}
Result
The compiled example

Open in the editor

Pitfalls

Compiled with pdfLaTeX from TeX Live 2023.

Related pages