[Tex/LaTex] How to get upright text as a subscript

subscripts

I want my subscript to be upright, so T and not as in $T$. How do I do it?

\documentclass{article}
\begin{document}
How can I get the subscript in $\Pr_T$ as T and not as in $T$?
\end{document}

Best Answer

Normally the effect is obtained using \mathrm using the amsmath package. I wouldn't recommend \text.

In fact, \mathrm is the correct way since it uses the upright font for the mathematical environment, while \text resorts using the current text font, which can cause the \text part to be e.g. in italics if the current text is set in italic.

See for example this:

\documentclass{book}
\usepackage{amsmath}
\usepackage{lipsum}
\begin{document}
I use \texttt{text} \( Pr_{\text{T}}\) and I use \texttt{mathrm}  \( Pr_{\mathrm{T}}\) 
\bigskip

{
\itshape
I use \texttt{text} \( Pr_{\text{T}}\) and I use \texttt{mathrm}  \( Pr_{\mathrm{T}}\) 
}

\end{document}

With result:

enter image description here

It's clear that the correct way to always obtain mathematical roman is \mathrm. Also, the \text command is conceived to typeset some text in the equations, strings such as "as given by" or "as you can see in".

From the documentation of amsmath

The main use of the command \text is for words or phrases in a display. It is very similar to the LATEX command \mbox in its effects, but has a couple of advantages. If you want a word or phrase of text in a subscript, you can type ...{\text{word or phrase}}, which is slightly easier than the \mbox equivalent: ...{\mbox{\scriptsize word or phrase}}. The other advantage is the more descriptive name.

Related Question