3

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}
egreg
  • 1,121,712
Great
  • 111

3 Answers3

2

You should never use $$ in LaTeX, see Why is \[ ... \] preferable to $$ ... $$?

I suggest using multline*, but with three lines, which makes a bit clearer the structure of the equation.

\documentclass[xcolor=table]{beamer}

\begin{document}

\begin{frame}

\begin{multline*}
\Lambda_{t}\biggl[1+\phi\biggl(\frac{K_{t+1}}{K_{t}}-g\biggr)\biggr]=\\
\beta E_{t}\Lambda_{t+1}\biggl[1-\delta+\alpha a_{t+1}
  \biggl(\frac{K_{t+1}}{X_{t+1}h_{t+1}}\biggr)^{\!\alpha-1}+{}\\
  \phi\frac{K_{t+2}}{K_{t+1}}\biggl(\frac{K_{t+2}}{K_{t+1}}-g\biggr)-
  \frac{\phi}{2}\biggl(\frac{K_{t+2}}{K_{t+1}}-g\biggr)^{\!2}\,\biggr]
\end{multline*}

\end{frame}

\end{document}

I prefer to size manually the fences; note also \! in the exponents near to large closing parentheses and \, before the last ], so it will be slightly moved farther from the exponent.

enter image description here

You may want to have the relation and operation signs in the continuation lines; just be consistent across your document. In this case the input should be

\begin{multline*}
\Lambda_{t}\biggl[1+\phi\biggl(\frac{K_{t+1}}{K_{t}}-g\biggr)\biggr]\\
=\beta E_{t}\Lambda_{t+1}\biggl[1-\delta+\alpha a_{t+1}
  \biggl(\frac{K_{t+1}}{X_{t+1}h_{t+1}}\biggr)^{\!\alpha-1}\\
  {}+\phi\frac{K_{t+2}}{K_{t+1}}\biggl(\frac{K_{t+2}}{K_{t+1}}-g\biggr)-
  \frac{\phi}{2}\biggl(\frac{K_{t+2}}{K_{t+1}}-g\biggr)^{\!2}\,\biggr]
\end{multline*}

that will produce

enter image description here

Note the {} preceding + in the continuation line (or +{} if you prefer to have it at the end of a line), which ensures correct spacing of the symbol.

Don't worry if this occupies more space than a two line approach; cramming as much as possible in a slide is wrong to begin with.

egreg
  • 1,121,712
1

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

Bernard
  • 271,350
1

You could use a multline* environment, and insert a linebreak instruction. Note that you can't use a \left[...\right] pair of fences for the outermost square brackets, since they span a line break. Use \Biggl[...\Biggr] instead.

enter image description here

\documentclass[xcolor=table]{beamer}
\begin{document}
\begin{frame}

\begin{multline*}
\Lambda_{t}\left[1+\phi\left(\frac{K_{t+1}}{K_{t}}-g\right)\right]
=\beta E_{t}\Lambda_{t+1}\Biggl[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}\,\Biggr]
\end{multline*}

\end{frame}
\end{document}
Mico
  • 506,678