[Tex/LaTex] Paragraph ended before \align was complete

align

\documentclass{article}

\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{amssymb}
\pagestyle{fancy}

\rhead{Homework for Stats Chapter 4\textbackslash Lab}

\cfoot{Page \thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}
\section{4.4 Excercises}
\begin{enumerate}
    \item For each experiment, list the sample space and the probabilities
          for each outcome. Compute the expected number of heads in each case.
    \begin{enumerate}
        \item Two independent tosses of a fair coin\\
        \{(HH),(HT),(TH),(TT)\}\\
        $\mathbb{P}(HH)=\frac{1}{4} \mathbb{P}(HT)
                =\frac{1}{4}\mathbb{P}(TH)=\frac{1}{4}\mathbb{P}(TT)
                =\frac{1}{4}$\\

        \begin{align}
        \mathbb{E}\left ( H\right )=\sum _{i=0}H_i\cdot p_i & =2\cdot\frac{1}{4}+1\cdot\frac{1}{4}+1\cdot\frac{1}{4}+0\cdot\frac{1}{4}\\
        & =\frac{1}{2}+\frac{1}{4}+\frac{1}{4}\\
        & =1\\

        \end{align}
\end{enumerate}
\end{enumerate}

\end{document}

Can't see where I'm messing up. I've closed everything. Getting "Paragraph ended before \align was complete.

Best Answer

You have a blank line in your align environment. I made some modifications to your code: replaced inline \frac (too small, in my opinion) with \mfrac (=medium-sized fractions, ~80 % of display style fractions) from the nccmath package, deleted another blank line and as I think each line of your alignment needs not be numbered, I took the liberty to replace it with an aligned environment, nested in equation.

\documentclass{article}

\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{amssymb}
\usepackage{nccmath}
\pagestyle{fancy}
\fancyhf{}
\rhead{Homework for Stats Chapter 4\textbackslash Lab}

\cfoot{Page \thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}

\section{4.4 Exercises}
\begin{enumerate}
 \item For each experiment, list the sample space and the probabilities
          for each outcome. Compute the expected number of heads in each case.
 \begin{enumerate}
 \item Two independent tosses of a fair coin\\
        \{(HH),(HT),(TH),(TT)\}\\
        $\mathbb{P}(HH)=\mfrac{1}{4} \mathbb{P}(HT)
                =\mfrac{1}{4}\mathbb{P}(TH)=\mfrac{1}{4}\mathbb{P}(TT)
                =\mfrac{1}{4}$

        \begin{equation}
        \begin{aligned}
        \mathbb{E}\left ( H\right )=∑ _{i=0}^4H_i · p_i & =2 · \frac{1}{4}+1 · \frac{1}{4}+1 · \frac{1}{4}+0 · \frac{1}{4}\\
        & =\frac{1}{2}+\frac{1}{4}+\frac{1}{4}\\
        & =1
        \end{aligned}
        \end{equation}
\end{enumerate}
\end{enumerate}
\end{document} 

enter image description here

Related Question