[Tex/LaTex] How to typeset subscript in usual text mode

subscripts

It's easy to make subscripts in math mode: $a_i$.

How do I make a subscript outside math environment, likethis?

Best Answer

Note that \textsubscript enters math mode as well. This might produce problems in PDF strings where math is not allowed, for instance in bookmarks. If you used hyperref and simply used \textsubscript in a section heading, hyperref would complain about the math shift. The command \texorpdfstring comes to the rescue:

\documentclass{article}
\usepackage{fixltx2e}
\usepackage{hyperref}
\begin{document}
\section{\texorpdfstring{like\textsubscript{this}}{like this}}
\end{document}

That applies to math and math symbols in sectioning headings of course as well.

Since 2015, LaTeX provides the fixltx2e features by default, so you can omit \usepackage{fixltx2e}then.