4

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}
Moriambar
  • 11,466

2 Answers2

6

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.

Moriambar
  • 11,466
  • How can I also have T bold as in \textbf{T} or $\mathbf{T}$ in the subscript? – Frode Alfson Bjørdal Apr 30 '17 at 14:09
  • I solved that using: \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{\mathbf{T}}}) }

    \end{document}

    – Frode Alfson Bjørdal Apr 30 '17 at 14:11
  • 1
    @FrodeBjørdal sure – Moriambar Apr 30 '17 at 14:11
1

You have to use a \text{} tag in your subscript,so in your example it would be $\Pr_{\text{T}}$.

Edit: I forgot to mention that in order for this to work you have to include the amsmathpackage.

Skydiver
  • 977