[Tex/LaTex] File ended while scanning use of \frac


I keep receiving the error message

File ended while scanning use of \frac ."

and have narrowed the error down to this equation, though I can't work out why.

\documentclass [12pt] {report}

\usepackage [doublespacing] {setspace}


\usepackage [top=3cm, bottom=3cm, left=4cm, right=2cm] {geometry}





\frac{\partial N}{\partial t}+\frac{\partial}{\partial x}\left(\frac{MN}{D}\right)+\frac{\partial}{\partial y}\left(\frac{N^2}{D}\right)+ gD\frac{\partial z}{\partial y}+\frac{\tau_{y}}{p}=0\\




Best Answer

The main issue is that you mustn't have blank lines in an equation environment -- or any display-math environment, for that matter.

An additional concern: If you use Times Roman as the text font, you should probably also load a Times Roman math font. The mathptmx and newtxtext/newtxmath packages may be suitable.

enter image description here

\usepackage{newtxtext,newtxmath} % Times Roman text and math fonts
\usepackage[vmargin=3cm, left=4cm, right=2cm]{geometry}

% For tighter spacing around \left/\right pairs of parentheses:
\usepackage{mleftright}  \mleftright 

\begin{equation} \label{eq2}
\frac{\partial N}{\partial t}+\frac{\partial}{\partial x}\left(\frac{MN}{D}\right)
 +\frac{\partial}{\partial y}\left(\frac{N^2}{D}\right)+ gD\frac{\partial z}{\partial y}