I have been looking on how to align equations and I have seen numerous examples with `\align` and `\flalign`, however whenever I try to use these in the `equation` environment, I get an error. I would like to be able to align the equations at the middle equal signs.

Here is an image of the current output:
![current output](https://i.stack.imgur.com/8PMiV.jpg)

```
\begin{proof}
Let   \begin{math} \varepsilon > 0 \end{math} be given and let \begin{math} \delta = \varepsilon \end{math}. It follows that for  \begin{math} I:(X,d^*) \to (R,d) \end{math}

\begin{equation*}
\text{if}\quad\d^*(f,g) = \int_a^b \bigg  |f(t) - g(t)\, \mathrm{d}t \  \bigg  | < \delta 
\end{equation*} 

\begin{equation*}
\text{then}\quad{\bigg  | \int_a^b f(t) - g(t)\, \mathrm{d}t  \bigg  |  =  \bigg  | \lim_{n \to \infty} \sum_{i=1}^{n}{M_i(t_i-t_{i-1})} \bigg  |\leq
\end{equation*} 
\begin{equation*}
\lim_{n \to \infty} \sum_{i=1}^{n}  \bigg  | {M_i(t_i-t_{i-1})} \bigg  |= \int_a^b \bigg  |f(t) - g(t)\, \mathrm{d}t \  \bigg  | < \delta = \varepsilon
\end{equation*}     
\end{proof}

```

I am now using `aligned` instead of the `equation` environment. Here is the code and the error I'm getting:

CODE:

```
\documentclass{article}
\usepackage{mathtools}
\usepackage{amsthm}
\begin{document}
\theoremstyle{definition}
\newtheorem{Prb1}{Problem}

\begin{Prb1}
 Since the the integral is nothing more that an infinite sum it obeys the triangle inequality. Hence, we may use this property to prove that \begin{math}I:(X,d^*) \to (R,d) \end{math} is continuous. Where \begin{math} d^*(f,g) = \int_a^b f(t) - g(t)\, \mathrm{d}t\end{math} for continuous functions \begin{math}f,g,\end{math} and \begin{math}I(f) = \int_a^b f(t) \, \mathrm{d}t \end{math} \hfill
\end{Prb1}

\begin{proof}

Let   \begin{math} \varepsilon > 0 \end{math} be given and let \begin{math} \delta = \varepsilon \end{math}. It follows that for  \begin{math} I:(X,d^*) \to (R,d) \end{math}

\begin{align*}
\text{if}\quad\d^*(f,g) &= \int_a^b \bigg  |f(t) - g(t)\, \mathrm{d}t \  \bigg  | < \delta \\
\text{then}\quad{\bigg  | \int_a^b f(t) - g(t)\, \mathrm{d}t  \bigg  |  &=  \bigg  | \lim_{n \to \infty} \sum_{i=1}^{n}{M_i(t_i-t_{i-1})} \bigg  |\leq \\
\lim_{n \to \infty} \sum_{i=1}^{n}  \bigg  | {M_i(t_i-t_{i-1})} \bigg  |&= \int_a^b \bigg  |f(t) - g(t)\, \mathrm{d}t \  \bigg  | < \delta = \varepsilon  \end{align*} 
\begin{equation*}
\text{if}\quad\ d^*(f,g) = \int_a^b \bigg  |f(t) - g(t)\, \mathrm{d}t \  \bigg  | < \delta \end{equation*} 

\end{proof}
\end{document}

```

ERROR:

```
))))
Runaway argument?
 \text {if}\quad \d ^*(f,g) &= \int _a^b \bigg |f(t) - g(t)\, \mathrm \ETC.
! Paragraph ended before \align* was complete.
<to be read again> 
                   \par 
l.25 

?

```