[Tex/LaTex] Word wrap in \text{} in math mode

math-mode

I'm trying to type formula, which requires some textual comments. I perform this using \text{} command in math mode. However, word wrap doesn't work. What should I do?
Code sample:

$P^1_{r,s}=\sum\limits_{i=r}^n{P(i\text{ applicant is selected and is the best})}=\sum\limits_{i=r}^n{P(i\text{ applicant is the best})*P(i\text{ is selected | is the best})}.$. 

As you can see on the screenshot, no word wrap is used and the line is cut.
Thanks in advance.

enter image description here

Best Answer

I would type the formula as displayed:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\noindent Text before.
\begin{align*}
  P_{r, s}^{1}
  &= \sum_{i = r}^{n} P(\text{$i$ applicant is selected and is the best})\\
  &= \sum_{i = r}^{n} P(\text{$i$ applicant is the best}) \cdot P(\text{$i$ is selected $\mid$ is the best})
\end{align*}
Text after.

\end{document}

output1

If you want to left-align the equations, you can do the following:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\noindent Text before.
\begin{flalign*}
  P_{r, s}^{1}
  &= \sum_{i = r}^{n} P(\text{$i$ applicant is selected and is the best}) &\\
  &= \sum_{i = r}^{n} P(\text{$i$ applicant is the best}) \cdot P(\text{$i$ is selected $\mid$ is the best})
\end{flalign*}
Text after.

\end{document}

output2

Related Question