[Tex/LaTex] overfull hbox in equation, can’t work out why

math-mode

I'm getting an "overfull hbox" error on the follow code,..I've tried line breaks in all kinds of places but I can't seem to fix it. Please help!

\begin{equation}
\frac{\partial M_u}{\partial z} = E_u - D_u \\
\frac{\partial (M_u s_u)}{\partial z} =  E_u \overline{s} - D_u s_u + L_v 
\overline{\rho} c_u \\
\frac{\partial (M_u q_u)}{\partial z} = E_u \overline{q} - D_u q_u  - 
\overline{\rho} c_u \\
\frac{\partial (M_u l)}{\partial z} = - D_u l + \overline{\rho} c_u - 
\overline{\rho} G_p \\
\end{equation}

Best Answer

Using the following code I got no overfull hbox error.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation}
\frac{\partial M_u}{\partial z} = E_u - D_u \\
\frac{\partial (M_u s_u)}{\partial z} =  E_u \overline{s} - D_u s_u + L_v 
\overline{\rho} c_u \\
\frac{\partial (M_u q_u)}{\partial z} = E_u \overline{q} - D_u q_u  - 
\overline{\rho} c_u \\
\frac{\partial (M_u l)}{\partial z} = - D_u l + \overline{\rho} c_u - 
\overline{\rho} G_p \\
\end{equation}

\end{document}

Maybe the problem is because your defined margins are shorter with respect to the default margins in the minimal document class.

As Au101 said, you should not use \\ on a equation environment. If you want the equations to be in different lines and numbered, you could use the align (or align* to appear without numbers) environment:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align}
\frac{\partial M_u}{\partial z} 
    &= E_u - D_u \\
\frac{\partial (M_u s_u)}{\partial z} 
    &= E_u \overline{s} - D_u s_u + L_v \overline{\rho} c_u \\
\frac{\partial (M_u q_u)}{\partial z} 
    &= E_u \overline{q} - D_u q_u  - \overline{\rho} c_u \\
\frac{\partial (M_u l)}{\partial z} 
    &= - D_u l + \overline{\rho} c_u - \overline{\rho} G_p 
\end{align}

\end{document}