left align broken equation using breqn package

The output of:

\documentclass{book}
\usepackage{amsmath}
\usepackage{breqn}
\setlength{\textwidth}{190pt}

\begin{document}
\begin{dgroup*}

\begin{dmath*}
125(x+2)^{3}= \left [5(x+2)+4(x- 5)\right ]\left [25(x+2)^{2}- 20(x+2)(x- 5)+16(x- 5)^{2}\right ]
\end{dmath*}
\begin{dmath*}
= (5x+10+4x- 20)\left (25(x^{2}+4x+4)- 20(x^{2}- 3x- 10)+\, \, 16(x^{2}- 10x+25)\right )
\end{dmath*}
\begin{dmath*}
= (9x- 10)(25x^{2}+100x+100- 20x^{2}+60x+200+16x^{2}- 160x+400)
\end{dmath*}
\begin{dmath*}
= (9x- 10)(21x^{2}+700)
\end{dmath*}
\begin{dmath*}
= 7(9x- 10)\, \, (3x^{2}+100)
\end{dmath*}

\end{dgroup*}

\end{document}


is

How to get the all equations to align at the = symbol and is there a way that we can align all the broken equation right after the = symbol?

• How important is \setlength{\textwidth}{190pt}? Can it be omitted? (190pt is only 6.68cm or 2.63" -- not exactly a lot of space to work with.) – Mico Mar 24 '18 at 11:17
• I had included 190pt to test the breaking as the resulting book would follow a two column design. – user9433640 Mar 25 '18 at 4:55

1 Answer

Use a single dmath* environment:

\documentclass{book}
\usepackage{amsmath}
\usepackage{breqn}
%\setlength{\textwidth}{190pt}

\begin{document}
\begin{dgroup*}

\begin{dmath*}
125(x+2)^{3}=  [5(x+2)+4(x- 5) ] [25(x+2)^{2}- 20(x+2)(x- 5)+16(x- 5)^{2} ]
= (5x+10+4x- 20) (25(x^{2}+4x+4)- 20(x^{2}- 3x- 10)+\, \, 16(x^{2}- 10x+25) )
= (9x- 10)(25x^{2}+100x+100- 20x^{2}+60x+200+16x^{2}- 160x+400)
= (9x- 10)(21x^{2}+700)
= 7(9x- 10)(3x^{2}+100)
\end{dmath*}

\end{dgroup*}

\end{document}


• Thank you very much for the suggestion, that makes a lot of sense. Is it possible to make the broken equation to align to the left below the ( in (5x + 10...? This is a school book and they require the broken equations to align on the left and not the right. – user9433640 Mar 25 '18 at 5:01
• @user9433640 If you need control on the alignment, don’t use breqn and do it by hand. – egreg Mar 25 '18 at 9:58