Search code examples
latexoverleaf

How to line break long equation in overleaf keeping both lines left sided, and keeping font-size as well?


My tries: 1st example: I didn't find how to fix the problem with th font size using \begin{array}. Code:

\begin{equation}
\begin{array}{l}
    \frac{\partial \rho}{\partial t}=-R_{z} \cos \delta_{E} \frac{\partial \delta_{E}}{\partial t}-R_{s}\left[-\sin \delta_{E} \frac{\partial \delta_{E}}{\partial t} \cos (\omega t+\lambda-\alpha_{E})+\right. \\
    \left.-\cos \delta_{E} \sin \left(\omega t+\lambda-\alpha_{E}\right)\left(\omega-\frac{\partial \alpha_{E}}{\partial t}\right)\right]
\end{array}
\end{equation} 

2nd example: Using \begin{split} I didn't find the way the to put second line on the left side. Code:

\begin{equation}
\begin{split}
    \frac{\partial \Dot{\rho}}{\partial\omega} = -R_{s}A[ A\omega t(\cos{\phi})^2\sin{\delta_{E}}\cos{(\lambda - A\sin{\omega t})} - \omega t\sin{\phi}\sin{(\lambda - A\sin{\omega t})} +\\+ \sin{(\lambda - A\sin{\omega t})}\cos{phi}] - R_{s}At\cos{\phi}\sin{\delta_{E}}\sin{(\lambda - A\sin{\omega t})}
\end{split}
\end{equation} 

Output of the code.

I also will appreciate a lot if somebody will tell me, that there is a magic command that breaks equation in lines automatically (without manually inserting '\')


Solution

  • My favourite way to do this is outlined in section 3.5.2 of lshort. For the sake of everyone, it requires the IEEEtrantools package. The code cited in the sources stated is the following:

    \begin{IEEEeqnarray}{rCl}
    a & = & b + c\\
      & = & d + e + f + g + h + i + j + k \nonumber\\
         && \negmedspace {} + l + m + n + o\\
      & = & p + q + r + s
    \end{IEEEeqnarray}
    

    Giving the result

    enter image description here

    Which you and others should be able to adapt appropriately for their own use case. The environment defines columns within the equation, which in this case has a right aligned column, followed by centre aligned, followed by left aligned using {rCl}.

    Note also that generally only one binary operation is used on the second line of a overflowing equation. And I feel that \cos{phi} in the second equation is meant to really be \cos\phi as it is elsewhere in your equations.