# overfull hbox in equation, can't work out why?

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!

$$\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 \\$$

• You shouldn't use \\ within an equation environment: tex.stackexchange.com/questions/8936/… Commented Mar 20, 2017 at 0:09
• You could replace equation with multline from the amsmath package and all will be fine.
– JPi
Commented Mar 20, 2017 at 0:20
• I did what you said and it worked, thanks a bunch :) Commented Mar 20, 2017 at 9:50

Using the following code I got no overfull hbox error.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

$$\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{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}

• No problem! Please remember to close this question. Happy TeXing! Commented Mar 22, 2017 at 1:51
• +1. I've taken the liberty of reformatting the align environment solution to remove the final double-backslash to generate more-natural line breaks in the code. Feel free to revert.
– Mico
Commented May 9, 2017 at 0:26