[Tex/LaTex] How to divide this equation into two lines

beamerequations

I'm making a beamer presentation and I can't divide this equation into two lines, because it is too long. Can somebody help me?

\documentclass[xcolor=table]{beamer}

\begin{document}

\begin{frame}

$$\Lambda_{t}\left[1+\phi\left(\frac{K_{t+1}}{K_{t}}-g\right)\right]=\beta E_{t}\Lambda_{t+1}\left[1-\delta+\alpha a_{t+1}\left(\frac{K_{t+1}}{X_{t+1}h_{t+1}}\right)^{\alpha-1}+\phi\frac{K_{t+2}}{K_{t+1}}\left(\frac{K_{t+2}}{K_{t+1}}-g\right)-\frac{\phi}{2}\left(\frac{K_{t+2}}{K_{t+1}}-g\right)^{2}\right]$$

\end{frame}

\end{document}

Best Answer

With the aligned environment. Btw, don't use $$ … $$, which is plain TeX syntax, and can produce incorrect vertical spacing, use \[ … \] instead.

\documentclass[xcolor=table]{beamer}
\usepackage{mathtools}
\geometry{showframe}
\begin{document}

\begin{frame}

  \[
    \begin{aligned}
      \Lambda_{t}\left[1+\phi\left(\frac{K_{t+1}}{K_{t}}-g\right)\right] & =\beta E_{t}\Lambda_{t+1}\left[1-\delta+\alpha a_{t+1}\left(\frac{K_{t+1}}{X_{t+1}h_{t+1}}\right)^{\!\!\alpha-1}\right. \\
                                                                         & \!\left.{}+\phi\frac{K_{t+2}}{K_{t+1}} \left(\frac{K_{t+2}}{K_{t+1}}-g\right)-\frac{\phi}{2}\left(\frac{K_{t+2}}{K_{t+1}}-g\right)^{\!\!2}\right]
    \end{aligned}
  \]
\end{frame}

\end{document} 

enter image description here

Related Question