1

In two sections of my report I have used \begin{equation} ... \end{equation}

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

\begin{equation}
 k_1u = AE\frac{\partial u}{\partial x}
\end{equation}

At $x=L,$ 

\begin{equation}
 k_2u = -AE\frac{\partial u}{\partial x}
\end{equation}
% =================================================
\begin{equation} 

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})

\end{equation}
For $x_3$, 

\begin{equation} 

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{equation}
2
  • Welcome to TeX SX! Load the amsmath package and use themultline environment for the last equation. Also: never insert blank lines in displayed equations.
    – Bernard
    Commented Apr 19, 2020 at 23:33
  • 2
    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

1 Answer 1

1

That is probably because you have spaces between \begin{equation} and your equation.

For example,

\begin{equation} 
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})
\end{equation}

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.

Example with your second equation:

\begin{equation}
\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}
\end{equation}
2
  • thank you so much
    – Sky
    Commented Apr 20, 2020 at 0:43
  • 1
    Don't hesitate to mark my answer as accepted if it helped you
    – Sileo
    Commented Apr 20, 2020 at 1:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .