In LaTeX, you can add line numbers to your document by adding

    \usepackage{lineno}

to your document preamble. However, sometimes the line numbers for whole paragraphs are missing - this is related to the math environment and occurs depending on whether you have a blank line before your equations or not. This can be fixed by adding the following to your preamble (http://phaseportrait.blogspot.com.au/2007/08/lineno-and-amsmath-compatibility.html)

\newcommand*\patchAmsMathEnvironmentForLineno[1]{
  \expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname
  \expandafter\let\csname oldend#1\expandafter\endcsname\csname end#1\endcsname
  \renewenvironment{#1}
  {\linenomath\csname old#1\endcsname}
  {\csname oldend#1\endcsname\endlinenomath}}
  \newcommand*\patchBothAmsMathEnvironmentsForLineno[1]{
  \patchAmsMathEnvironmentForLineno{#1}
  \patchAmsMathEnvironmentForLineno{#1*}}
  \AtBeginDocument{
  \patchBothAmsMathEnvironmentsForLineno{equation}
  \patchBothAmsMathEnvironmentsForLineno{align}
  \patchBothAmsMathEnvironmentsForLineno{flalign}
  \patchBothAmsMathEnvironmentsForLineno{alignat}
  \patchBothAmsMathEnvironmentsForLineno{gather}
  \patchBothAmsMathEnvironmentsForLineno{multline}
}