How can I make a subscript of 'p' in fp(x) = ...
I have this code right now, but I think there's a better way:
$f\textsc{$p$}(x)=x^3-x^2+px+1$
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityHow can I make a subscript of 'p' in fp(x) = ...
I have this code right now, but I think there's a better way:
$f\textsc{$p$}(x)=x^3-x^2+px+1$
Subscripts in math mode are initiated using _
, as in the following example:
\documentclass{article}
\begin{document}
$f_p(x) = x^3 - x^2 + px + 1$
\end{document}
For sub-scripting multiple items, brace them using _{...}
. If you want to write text in the subscript, use amsmath
's \text
for the prevailing text font, or \mathrm
for a forced upright font:
\documentclass{article}
\usepackage{amsmath}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
This is a theorem
\begin{align*}
f_{\text{prob}}(x) &= x^3 - x^2 + px + 1 \\
f_{\mathrm{prob}}(x) &= x^3 - x^2 + px + 1
\end{align*}
\end{theorem}
Some regular text.
\begin{align*}
f_{\text{prob}}(x) &= x^3 - x^2 + px + 1 \\
f_{\mathrm{prob}}(x) &= x^3 - x^2 + px + 1
\end{align*}
\end{document}
\mathrm
. With \text
the font will be the one current outside the formula, which may not be upright.
– egreg
Nov 26 '14 at 23:08
\mathrm
(or \mathup
) instead of \textrm
(or \textup
)?
– Manuel
Nov 27 '14 at 1:39
\mathrm
if you want the content set as math and \textrm
if you want the content set as text. Compare \mathrm{hello world 1 - 1}
and \textrm{hello world 1 - 1}
– David Carlisle
Nov 27 '14 at 9:32
\textsc
is nothing to do with subscripts: it selects caps and small caps font. – David Carlisle Nov 26 '14 at 23:03