# [Tex/LaTex] dmath and alignement

equationsmath-modesplit

I use the dmath environnement to split equations.
I am not satisfy how it manages the alignement of each new lines. In particular, here, Sometimes equations are aligned with respect to the begin, other times (in the same environment), with respect to the end of the line.

Here my sample:

\begin{dmath}
x_{4}(s) = \frac{1}{\omega^3} \Big[  x_4(\varphi_0) -2  \cos^3 ( \phi )sk^2 +2k^2x_1(\varphi_0) \cos^2( \phi )
+4  \cos^3 ( \phi )E ( s ) k^2+x_3(\varphi_0)\sin ( \phi ) s  - \cos^3( \phi ){s}^2E( s )
+2  \cos^3 ( \phi )s ( E (s) ^2 +\cos ( \phi ) {s}^2E ( s ) - 2x_3(\varphi_0)\sin ( \phi ) E ( s )
-1/6\cos ( \phi ) {s}^3-4/3 \cos^3 ( \phi )  E ( s ) ^3
-1/2 x_1(\varphi_0)  \cos^2 ( \phi ){s}^2-2 x_1(\varphi_0) \cos^2 ( \phi )  E ( s ) ^2 -2\cos ( \phi) s  E ( s ) ^2
-2x_1(\varphi_0)sE( s ) + k\sin (\phi ) cn(s) {s}^2  \cos^2( \phi ) +2  \cos^3 ( \phi )sk^2  sn(s) ^2
-2/3\cos ( \phi) E ( s)  +4/3k^3cn(s) sn(s) ^2\sin( \phi ) \cos^2 ( \phi )+2k\sin ( \phi ) cn(s)
+2/3\cos ( \phi ) s-8/3\cos ( \phi ) k^2dn (s) sn(s) cn(s) -8/3k^3\sin ( \phi ) cn(s) +4/3E ( s ) k^2\cos ( \phi )
-2/3sk^2\cos( \phi ) -4  \cos^3 ( \phi )k^2  sn(s)^2E ( s ) +2x_1(\varphi_0)  \cos^2 ( \phi )sE ( s )
-2x_3(\varphi_0)k\cos ( \phi ) cn(s) +1/2x_1(\varphi_0){s}^2 -4/3k^3\sin ( \phi) cn(s) \cos^2 ( \phi) -2k\sin ( \phi ) cn(s) x_1(\varphi_0)\cos ( \phi ) s+4k\sin( \phi ) cn(s) x_1(\varphi_0)\cos( \phi ) E ( s )+1/6   \cos^3 ( \phi ){s}^3+4/3\cos( \phi )( E (s) ^3 -4/3k^3cn(s) sn(s)^2\sin (\phi ) -2k^2 x_1(\varphi_0)  \cos^2 ( \phi )  sn(s) ^2+2x_1(\varphi_0)  E ( s ) ^2-4k\sin ( \phi ) cn(s) sE ( s ) \cos^2 ( \phi)+4k\sin ( \phi ) cn(s) E ( s )^2  \cos^2 ( \phi )\Big].
\end{dmath}


and the output

#### Best Answer

Contrary to common belief, breqn is not able to cope with this kind of display. You can use TeX’s standard ability of breaking at binary operations (but only after them, I'm afraid).

\documentclass{article}
\usepackage{newtxtext,newtxmath}
\usepackage{amsmath}

\DeclareMathOperator{\sn}{sn}
\DeclareMathOperator{\cn}{cn}
\DeclareMathOperator{\dn}{dn}

\begin{document}

$$\begin{gathered} \omega^3x_{4}(s) = \begin{minipage}[t]{.7\displaywidth} \raggedright\linespread{1.2}\selectfont \begin{math} x_4(\varphi_0) -2 \cos^3 ( \phi )sk^2 +2k^2x_1(\varphi_0) \cos^2( \phi ) +4 \cos^3 ( \phi )E ( s ) k^2+x_3(\varphi_0)\sin ( \phi ) s - \cos^3( \phi ){s}^2E( s ) +2 \cos^3 ( \phi )s ( E (s) ^2 +\cos ( \phi ) {s}^2E ( s ) - 2x_3(\varphi_0)\sin ( \phi ) E ( s ) -1/6\cos ( \phi ) {s}^3-4/3 \cos^3 ( \phi ) E ( s ) ^3 -1/2 x_1(\varphi_0) \cos^2 ( \phi ){s}^2-2 x_1(\varphi_0) \cos^2 ( \phi ) E ( s ) ^2 -2\cos ( \phi) s E ( s ) ^2 -2x_1(\varphi_0)sE( s ) + k\sin (\phi ) \cn(s) {s}^2 \cos^2( \phi ) +2 \cos^3 ( \phi )sk^2 \sn(s) ^2 -2/3\cos ( \phi) E ( s) +4/3k^3\cn(s) \sn(s) ^2\sin( \phi ) \cos^2 ( \phi )+2k\sin ( \phi ) \cn(s) +2/3\cos ( \phi ) s-8/3\cos ( \phi ) k^2\dn (s) \sn(s) \cn(s) -8/3k^3\sin ( \phi ) \cn(s) +4/3E ( s ) k^2\cos ( \phi ) -2/3sk^2\cos( \phi ) -4 \cos^3 ( \phi )k^2 \sn(s)^2E ( s ) +2x_1(\varphi_0) \cos^2 ( \phi )sE ( s ) -2x_3(\varphi_0)k\cos ( \phi ) \cn(s) +1/2x_1(\varphi_0){s}^2 -4/3k^3\sin ( \phi) \cn(s) \cos^2 ( \phi) -2k\sin ( \phi ) \cn(s) x_1(\varphi_0)\cos ( \phi ) s+4k\sin( \phi ) \cn(s) x_1(\varphi_0)\cos( \phi ) E ( s )+1/6 \cos^3 ( \phi ){s}^3+4/3\cos( \phi )( E (s) ^3 -4/3k^3\cn(s) \sn(s)^2\sin (\phi ) -2k^2 x_1(\varphi_0) \cos^2 ( \phi ) \sn(s) ^2+2x_1(\varphi_0) E ( s ) ^2-4k\sin ( \phi ) \cn(s) sE ( s ) \cos^2 ( \phi)+4k\sin ( \phi ) \cn(s) E ( s )^2 \cos^2 ( \phi ). \end{math} \end{minipage} \end{gathered}$$

\end{document}