# Equations messed up with large spaces in between. Numbering Is not adjacent to equation. Report due tonight

In two sections of my report I have used $$...$$

In the first section the equations looked fine but in the second section they were messed up.

The following are pictures and codes for the good section and bad section respectively. https://i.sstatic.net/LjCXE.jpg

At $x=0,$

$$k_1u = AE\frac{\partial u}{\partial x}$$

At $x=L,$

$$k_2u = -AE\frac{\partial u}{\partial x}$$
% =================================================
$$m_2\ddot{x_2}+k_1x_2-k_2(x_3+L_2\theta-x_2)+m_2g= F_2-c_1\dot{x_2}+c_2(\dot{x_3}-L_2\dot{\theta}-\dot{x_2})$$
For $x_3$,

$$M\ddot{x_3}+k_2(x_3-L_1\theta-x_1)+k_2(x_3+L_2\theta-x_2) + Mg = +c_2(\dot{x_3}+L_2\dot{\theta}-\dot{x_2})-c_2(x_3-L_1\dot{\theta}-\dot{x_1})$$

• Welcome to TeX SX! Load the amsmath package and use themultline environment for the last equation. Also: never insert blank lines in displayed equations. Commented Apr 19, 2020 at 23:33
• Don't insert a blank line before an equation either. And only put a blank line after an equation if the following text begins a new paragraph. Commented Apr 19, 2020 at 23:51

That is probably because you have spaces between and your equation.

For example,

$$m_2\ddot{x_2}+k_1x_2-k_2(x_3+L_2\theta-x_2)+m_2g= F_2-c_1\dot{x_2}+c_2(\dot{x_3}-L_2\dot{\theta}-\dot{x_2})$$


compiles correctly.

In addition to this, you might want to use multline (break automatically) or split (break manually) in order for your equations to be displayed nicely. That requires the amsmath package.

$$\begin{split} M\ddot{x_3}+k_2(x_3-L_1\theta-x_1)+k_2(x_3+L_2\theta-x_2) + Mg = & +c_2(\dot{x_3}+L_2\dot{\theta}-\dot{x_2})\\ & -c_2(x_3-L_1\dot{\theta}-\dot{x_1}) \end{split}$$