How to have a normal line of text inside a math environment and align it correctly in LaTeX?

Viewed 2988

I'm a LaTeX beginner and would like to have two equations aligned on the equals symbol which is working fine so far. Now, between these two equations I need a line of text. But LaTeX interprets this as a math formula since it's showing a (2) right next to it. I would like to have it as normal text without a (2) aligned on the far left. I have already tried things like

\begin{flushleft} line of text \end{flushleft}

but it's not working, maybe because I'm using it inside an {align} environment. Not sure if it's important to mention but I'm using Overleaf (online LaTeX editor).

\begin{align}
  \tilde{w}_{ij} &=
    \begin{cases}
      w_{ij} & \text{mit $P(i)$}\\
      0 & \text{sonst}
    \end{cases}\\       
\text{This text be on the far left}\\
  \tilde{w}_{ij} &= w_{ij} * P(i)      
\end{align}

produces this ->

output

1 Answers

This sounds like a job for \intertext from amsmath:

\documentclass{article}

\usepackage{mathtools}

\begin{document}


\begin{align}
  \tilde{w}_{ij} &=
    \begin{cases}
      w_{ij} & \text{mit $P(i)$}\\
      0 & \text{sonst}
    \end{cases}\\       
\intertext{This text be on the far left}
  \tilde{w}_{ij} &= w_{ij} * P(i)      
\end{align}

\end{document}

enter image description here

Related