2

I have the following problem with breqn package: I want to write a long equation and automatically split it with dmath environment. It is splitting equation perfectly, but placing the equation number one line below. I want to have a result such that last part of the equation and equation number are in the same line.

Here is the code I'm trying to fix:

\documentclass{article}
\usepackage{breqn}
\begin{document}
\begin{dmath}
{{E}_{0}}\sum\limits_{t=0}^{\infty }\beta _{B}^{t}\left({{D}_{t+1}}+\left( 1+r_{f,t-1} \right)L_{f,t}+\left( 1+r_{g,t-1} \right)L_{g,t}+\left( 1+r_{i,t-1} \right)L_{i,t}-L_{f,t+1}-L_{g,t+1}-L_{i,t+1}-\left( 1+r_{p,t-1} \right){{D}_{t}} -\frac{{{\phi }_{f}}}{2} L_{f,t+1}^{2}-\frac{{{\phi }_{g}}}{2}L_{g,t+1}^{2}-\frac{\phi_{i}}{2}L_{i,t+1}^{2} \right)
\end{dmath}
\end{document}

enter image description here Thank you.

EDIT: I was told that the space in the second line is not enough to place the equation number. How about following case where I have exactly the same equation given in 3 line with more than enough space to place equation number in the same row:

\documentclass{beamer}
\usetheme{Madrid}
\usepackage{breqn}
\begin{document}
\begin{frame}
\frametitle{Problem}
\begin{dmath}
{{E}_{0}}\sum\limits_{t=0}^{\infty }\beta _{B}^{t}\left({{D}_{t+1}}+\left( 1+r_{f,t-1} \right)L_{f,t}+\left( 1+r_{g,t-1} \right)L_{g,t}+\left( 1+r_{i,t-1} \right)L_{i,t}-L_{f,t+1}-L_{g,t+1}-L_{i,t+1}-\left( 1+r_{p,t-1} \right){{D}_{t}} -\frac{{{\phi }_{f}}}{2} L_{f,t+1}^{2}-\frac{{{\phi }_{g}}}{2}L_{g,t+1}^{2}-\frac{\phi_{i}}{2}L_{i,t+1}^{2} \right)
\end{dmath}
\end{frame}\end{document}

enter image description here

  • Welcome to TeX.SX! Apparently, breqn isn't willing to split the equation in three lines. – egreg Feb 20 '17 at 18:37
  • There is enough space in the second line to squeeze the equation number – Behzod A Feb 20 '17 at 18:43
  • 1
    No, there isn't. – egreg Feb 20 '17 at 18:44
  • please take a look at the layouts supported by breqn, as shown in the documentation (texdoc breqn). breqn will not by itself set the final line so that it ends to the left of the next-to-last line unless there is a clear "preferable" breakpoint (sucn as an = sign) that mandates a more leftward placement. – barbara beeton Feb 20 '17 at 19:48
  • That's a limitation of breqn (which has many). – egreg Feb 20 '17 at 20:37
1

I cannot recommend breqn except when you don't want to bother with typesetting and are willing to accept poor output.

Apparently, the package is not keen into splitting the equation across three lines. Here is a better way to cope with this.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\begin{split}
E_{0}\sum_{t=0}^{\infty }\beta _{B}^{t}
  \biggl(&D_{t+1}+(1+r_{f,t-1})L_{f,t}+(1+r_{g,t-1})L_{g,t} \\
        &+(1+r_{i,t-1})L_{i,t}-L_{f,t+1}-L_{g,t+1}-L_{i,t+1}\\
        &-(1+r_{p,t-1}){{D}_{t}} -\frac{\phi_{f}}{2} L_{f,t+1}^{2}
         -\frac{\phi_{g}}{2}L_{g,t+1}^{2}-\frac{\phi_{i}}{2}L_{i,t+1}^{2}
  \biggr)
\end{split}
\end{equation}

\end{document}

enter image description here

  • Hi, as I previously mentioned there is no need for the 3rd line. There is enough space in the second line to accommodate the equation number – Behzod A Feb 20 '17 at 18:45
  • 1
    @TashkentYankee -- there is not sufficient space for the equation number unless the second line is shoved all the way to the left, and that violates the rules of breqn. the supported layouts are illustrated in the documentation, and that isn't among them. – barbara beeton Feb 20 '17 at 18:52
  • @TashkentYankee, enough place is only available if you make text width wider. For example with adding usepackage{geometry} to preamble of your MWE ... – Zarko Feb 20 '17 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.