8

There is the package breqn for automatically breaking long math equations. I have used it, but there are three problems that I am facing.

  • First: How can I implement the "Drop Ladder Layout", described in the package documentation of breqn?
  • Second: How can I reach a ragged-right alignment of the rhs in the equation?
  • Third: How can I implement a pagebreak within breqn?

Thanks, Peter

Here is the code containing the problems:

\documentclass[10pt, a5paper]{article}
\usepackage{amsmath}
\usepackage[]{breqn}

\renewcommand\[{\begin{dmath}}
\renewcommand\]{\end{dmath}}

%\allowdisplaybreaks
%\interdisplaylinepenalty=0

\begin{document}

\[
P_{5 \text{,}\: avg\text{,}\: var1}\left(T_1\right) 
= \left( \lambda _{DU}+\lambda _{DD} \right) \lambda _{DR}\,T_{1}
+\left(  \left( -\frac{1}{2}\,\mu _{0}\,\lambda _{DD}-\frac{1}{3}\,{\lambda _{DD}}^{2}   -\lambda _{DU}\,\lambda _{DD}-\frac{1}{4}\,\lambda _{DD}\,\mu _{DR}
-\frac{1}{5}\,{\lambda _{DU}}^{2}-\frac{1}{6}\,\lambda _{DU}\,\mu _{DR}
-\frac{1}{7}\,\mu _{LT}\,\lambda _{DU} \right) \lambda _{DR}
-\left( \frac{1}{8}\,\lambda _{DU}+\frac{1}{9}\,\lambda _{DD} \right) {\lambda _{DR}}^{2} \right) {T_{1}}^{2}
 + \left(  \left( \frac{1}{10}\,\lambda _{DD}\,{\mu _{0}}^{2}+\frac{1}{20}\,\mu _{0}\,{\lambda _{DD}}^{2} 
 +\frac{1}{30}\,\mu _{0}\,\lambda _{DU}\,\lambda _{DD}+\frac{1}{40}\,{\lambda _{DD}}^{3}
 +\frac{1}{50}\,\lambda _{DU}\,{\lambda _{DD}}^{2}+\,\frac{1}{60}\,{\lambda _{DD}}^{2}\,\mu _{DR} 
 +\frac{1}{70}\,{\lambda _{DU}}^{2}\,\lambda _{DD}+\frac{1}{80}\,\lambda _{DU}\,\lambda _{DD}\,\mu _{DR}
 +\frac{1}{90}\,\lambda _{DD}\,\mu _{LT}\,\lambda _{DU}+\frac{1}{100}\,\lambda _{DD}\,{\mu _{DR}}^{2} 
 +\frac{1}{110}\,{\lambda _{DU}}^{3}+\frac{1}{120}\,{\lambda _{DU}}^{2}\,\mu _{DR} 
 +\frac{1}{130}\,\mu _{LT}\,{\lambda _{DU}}^{2}+\frac{1}{140}\,\lambda _{DU}\,{\mu _{DR}}^{2}  
 +\frac{1}{150}\,{\mu _{LT}}^{2}\,\lambda _{DU} \right) \lambda _{DR} 
 +\left( \frac{1}{160}\,\lambda _{DD}\,\mu _{0}+\frac{1}{170}\,{\lambda _{DD}}^{2}
 +\frac{1}{180}\,\lambda _{DU}\,\lambda _{DD}+\frac{1}{190}\,\lambda _{DD}\,\mu _{DR} 
 +\frac{1}{200}\,{\lambda _{DU}}^{2}+\frac{1}{210}\,\lambda _{DU}\,\mu _{DR} 
 +\frac{1}{220}\,\mu _{LT}\,\lambda _{DU} \right) {\lambda _{DR}}^{2} 
 +\left(\frac{1}{230}\, \lambda _{DU}+\frac{1}{240}\,\lambda _{DD}\right) {\lambda _{DR}}^{3} \right) {T_{1}}^{3} \text{.}
\]

\end{document}
  • 1
    If such ugly code is produced by Maple, then ask its developers to provide a better conversion. There's little one can do for improving it on the TeX side. Particularly wrong is the abuse of \left and \right; also \, is abused and, as I already commented, {\lambda_{DD}}^2 is absurd. – egreg Jul 4 '16 at 23:57
2

I don't think you can get a nice result with any package. With breqn, instead, it's almost impossible.

\documentclass[10pt, a5paper]{article}
\usepackage{amsmath}

\begin{document}

\begin{flushleft}
\linespread{2.5}\selectfont
\leftskip=3em
\hspace*{-3em}$\displaystyle
P^{}_{5,\,\mathrm{avg},\, \mathrm{var}1}(T_1) 
= ( \lambda _{DU}+\lambda _{DD} ) \lambda _{DR}T_{1}
+\biggl(  \biggl( -\frac{1}{2}\mu _{0}\lambda _{DD}-\frac{1}{3}{\lambda _{DD}}^{2}
-\lambda _{DU}\lambda _{DD}-\frac{1}{4}\lambda _{DD}\mu _{DR}
-\frac{1}{5}{\lambda _{DU}}^{2}-\frac{1}{6}\lambda _{DU}\mu _{DR}
-\frac{1}{7}\mu _{LT}\lambda _{DU} \biggr) \lambda _{DR}
-\biggl( \frac{1}{8}\lambda _{DU}+\frac{1}{9}\lambda _{DD} \biggr)
  {\lambda _{DR}}^{2} \biggr) {T_{1}}^{2}
+ \biggl(  \biggl( \frac{1}{10}\lambda _{DD}{\mu _{0}}^{2}
+\frac{1}{20}\mu _{0}{\lambda _{DD}}^{2} 
+\frac{1}{30}\mu _{0}\lambda _{DU}\lambda _{DD}+\frac{1}{40}{\lambda _{DD}}^{3}
+\frac{1}{50}\lambda _{DU}{\lambda _{DD}}^{2}+\frac{1}{60}{\lambda _{DD}}^{2}\mu _{DR} 
+\frac{1}{70}{\lambda _{DU}}^{2}\lambda _{DD}+\frac{1}{80}\lambda _{DU}\lambda _{DD}\mu _{DR}
+\frac{1}{90}\lambda _{DD}\mu _{LT}\lambda _{DU}+\frac{1}{100}\lambda _{DD}{\mu _{DR}}^{2} 
+\frac{1}{110}{\lambda _{DU}}^{3}+\frac{1}{120}{\lambda _{DU}}^{2}\mu _{DR} 
+\frac{1}{130}\mu _{LT}{\lambda _{DU}}^{2}+\frac{1}{140}\lambda _{DU}{\mu _{DR}}^{2}  
+\frac{1}{150}{\mu _{LT}}^{2}\lambda _{DU} \biggr) \lambda _{DR} 
+\biggl( \frac{1}{160}\lambda _{DD}\mu _{0}+\frac{1}{170}{\lambda _{DD}}^{2}
+\frac{1}{180}\lambda _{DU}\lambda _{DD}+\frac{1}{190}\lambda _{DD}\mu _{DR} 
+\frac{1}{200}{\lambda _{DU}}^{2}+\frac{1}{210}\lambda _{DU}\mu _{DR} 
+\frac{1}{220}\mu _{LT}\lambda _{DU} \biggr) {\lambda _{DR}}^{2} 
+\biggl(\frac{1}{230} \lambda _{DU}+\frac{1}{240}\lambda _{DD}\biggr)
  {\lambda _{DR}}^{3} \biggr) {T_{1}}^{3}.
$
\end{flushleft}

\end{document}

It's ugly as well, but less horrible than what you get with breqn. And it breaks across pages.

enter image description here

Note. I removed all \, that serve no purpose; it's not clear why typing {T_{1}}^{2} instead of the customary T_{1}^{2}. In particular, {\lambda_{DD}}^{2} results in a very unclear output, because the superscript seems rather to DD than to \lambda_{DD}.

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.