If I run the code you posted I get the error:
! Missing } inserted.
<inserted text>
}
l.10 r_s^{\WPT
} = 100.00
?
this error happens because when your command expands you have (up to the point where the error happens) basically:
$$ r_s^{ $
which is not a valid TeX construct. You start display math, you start a group, then you end an inline math. Later on TeX would say that:
! Display math should end with $$.
<to be read again>
p
l.13 r_s^{$p
_{\text{T}}^W$} = 100
?
and would get even more confused trying to fix all that.
You can use \ensuremath
which, as the name says, ensures that its contents are typeset in math-mode (notice the extra {}
after \WPT
in the text here):
\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\newcommand{\WPT}{\ensuremath{p_{\text{T}}^W}}
\begin{document}
The result for \WPT{} is shown below.
\begin{equation}
r_s^{\WPT} = 100.00
\end{equation}
\end{document}
but, since \WPT
is essentially math content, I'd go for the proper markup and wrap \WPT
in $
...$
in the text:
\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\newcommand{\WPT}{p_{\text{T}}^W}
\begin{document}
The result for $\WPT$ is shown below.
\begin{equation}
r_s^{\WPT} = 100.00
\end{equation}
\end{document}
\newcommand{\WPT}{\ensuremath{p_{\text{T}}^W}}
instead.\WPT
as mentioned in the answer, theequation
environment does not support the use of&
.