[Tex/LaTex] How to align equations in “Breqn” package

breqn

I am using breqn package for automatic breaking of long math equations. I am having problem in alignment of equations as the equations of shorter lengths tends to miss align with equations of longer lengths. Please see example code below:

\documentclass[fleqn,preprint,10pt]{article}
\usepackage{amsmath}
\usepackage{breqn}
\begin{document}
\begin{dgroup*}
\begin{dmath*}
C_{8}^{1} = -xh{c}^{2}\psi_{{y,y}}-h_{{x}}{c}^{2}\psi_{{t}}t-h_{{x}}{c}^{2}\psi_{{
x}}x-h_{{x}}{c}^{2}\psi_{{y}}y-h_{{x}}{c}^{2}\psi_{{z}}z-2\,h_{{x}}{c}
^{2}\psi-2\,xh{u_{{z}}}^{2}+xh\psi_{{t,t}}-2\,xh{v_{{y}}}^{2}-2\,xh{v_
{{z}}}^{2}-2\,xh{u_{{y}}}^{2}+6\,hu_{{x}}u+xgv_{{t,t}}+xfu_{{t,t}}-xgv
_{{z,z}}-xgv_{{y,y}}+fzu_{{x,z}}+gtv_{{x,t}}+fyu_{{x,y}}+ftu_{{x,t}}+g
zv_{{x,z}}+gyv_{{x,y}}+xfu-2\,h_{{x}}vv_{{x}}x-2\,h_{{x}}vv_{{t}}t-2\,
h_{{x}}uu_{{z}}z-2\,h_{{x}}uu_{{y}}y-2\,h_{{x}}uu_{{x}}x-2\,h_{{x}}uu_
{{t}}t-2\,h_{{x}}vv_{{z}}z-2\,h_{{x}}vv_{{y}}y-xh{c}^{2}\psi_{{z,z}}-2
\,xhuu_{{y,y}}-2\,xhuu_{{z,z}}-2\,xhvv_{{y,y}}-2\,xhvv_{{z,z}}+2\,hv_{
{x}}v_{{y}}y+2\,hv_{{x}}v_{{z}}z+2\,hv_{{x}}v_{{t}}t+2\,hu_{{x}}u_{{z}
}z+2\,hu_{{x}}u_{{y}}y+2\,hu_{{x}}u_{{t}}t+2\,hutu_{{x,t}}+2\,huyu_{{x
,y}}+h{c}^{2}z\psi_{{x,z}}+2\,hvzv_{{x,z}}+h{c}^{2}t\psi_{{x,t}}+2\,hu
zu_{{x,z}}+2\,hvtv_{{x,t}}+2\,hvyv_{{x,y}}+h{c}^{2}y\psi_{{x,y}}+xf
\psi\,u+xg\psi\,v-2\,h_{{x}}{c}^{2}-g_{{x}}v-f_{{x}}u-2\,h_{{x}}{u}^{2
}+2\,fu_{{x}}-2\,h_{{x}}{v}^{2}+2\,gv_{{x}}-f_{{x}}u_{{x}}x-f_{{x}}u_{
{t}}t-f_{{x}}u_{{y}}y-f_{{x}}u_{{z}}z-g_{{x}}v_{{x}}x-g_{{x}}v_{{y}}y-
g_{{x}}v_{{z}}z-g_{{x}}v_{{t}}t+xgv+6\,hv_{{x}}v+3\,h{c}^{2}\psi_{{x}}
-xfu_{{y,y}}-xfu_{{z,z}}
\end{dmath*}
\end{dgroup*}
\begin{dgroup*}
\begin{dmath*}
C_{9}^{1} = -fv_{{x}}+gu_{{x}}-ug_{{x}}+vf_{{x}}
\end{dmath*}
\begin{dmath*}
C_{9}^{2} = -fv_{{y}}+gu_{{y}}-ug_{{y}}+vf_{{y}}
\end{dmath*}
\begin{dmath*}
C_{9}^{3} = -fv_{{z}}+gu_{{z}}-ug_{{z}}+vf_{{z}}
\end{dmath*}
\end{dgroup*}
\end{document}  

Best Answer

To have them aligned they have to be inside the same dgroup* environment, which acts like the align environment of amsmath.

\documentclass[fleqn,preprint,10pt]{article}
\usepackage{amsmath}
\usepackage{breqn}
\begin{document}
\begin{dgroup*}
\begin{dmath*}
C_{8}^{1} = -xh{c}^{2}\psi_{{y,y}}-h_{{x}}{c}^{2}\psi_{{t}}t-h_{{x}}{c}^{2}\psi_{{
x}}x-h_{{x}}{c}^{2}\psi_{{y}}y-h_{{x}}{c}^{2}\psi_{{z}}z-2\,h_{{x}}{c}
^{2}\psi-2\,xh{u_{{z}}}^{2}+xh\psi_{{t,t}}-2\,xh{v_{{y}}}^{2}-2\,xh{v_
{{z}}}^{2}-2\,xh{u_{{y}}}^{2}+6\,hu_{{x}}u+xgv_{{t,t}}+xfu_{{t,t}}-xgv
_{{z,z}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_{{x}}
\end{dmath*}
\begin{dmath*}
C_{9}^{2} = -fv_{{y}}+gu_{{y}}-ug_{{y}}+vf_{{y}}
\end{dmath*}
\begin{dmath*}
C_{9}^{3} = -fv_{{z}}+gu_{{z}}-ug_{{z}}+vf_{{z}}
\end{dmath*}
\end{dgroup*}
\end{document}  

enter image description here