[Tex/LaTex] Aligning equations within multline

math-mode

I have this really long equation and I have used multline to break it up. I also want to align the broken bits of the equation to the left. When I use align, for some reasons it aligns to the right when I want it to be on the left.
How can I align to the left?

\begin{multline}
\begin{align}
\mathcal{H}_{q1} \mathcal{H}_{q2} \mathcal{H}_{q3}...\mathcal{H}_{qn}0=\frac{1}{2}H_{q1}\{\mathcal{H}_{q2}\mathcal{H}_{q3}...\mathcal{H}_{qn}0\}+\frac{1}{2} h_{q1} \\
=\frac{1}{2}H_{q1}\{\frac{1}{2} H_{q2}[\mathcal{H}_{q3}...\mathcal{H}_{qn} 0]+\frac{1}{2}h_{q2}\} +\frac{1}{2}h_{q1}=\\
\frac{1}{2}H_{q1} \frac{1}{2} H_{q2} [\frac{1}{2}H_{q3}(\mathcal{H}_{q4}..\mathcal{H}_{qn}0)+\frac{1}{2}h_{q3}]+
\frac{1}{2}h_{q2}+\frac{1}{2}h_{q1}=...\\
         =(\frac{1}{2^n})H_{q1}H_{q2}H_{q3}..H_{qn}0+ (\frac{1}{2^n})H_{q1}H_{q2}H_{q3}..H_{qn-1}h_{q1}\\+(\frac{1}{2^n})H_{q1}H_{q2}H_{q3}..H_{qn-2}h_{qn-1}+.. \\+
(\frac{1}{2})h_{q1}=\sum^n_{j=1} (\frac{1}{2^j}) H_{qo}H_{q1} H_{q2}H_{q3}..H_{qj-1} h_{qj}
\end{align}
\end{multline}

Best Answer

You can insert a multlined environment (from mathtools) inside align. However I think it's better to use aligned inside align. I added a \mathdotfill macro with argument the length of the dotline. Also, I used the medium sized fractions fom nccmath fir the coefficients 1/2.

Finally, as I wondered whether the series of q1 , q2 , qn and so on, is a mistyping for q_1 , q_2, q_n . So I propose this other version.

\documentclass{article}
\usepackage{mathtools, nccmath}
\usepackage{geometry}
\usepackage{eqparbox}
\makeatother
\newcommand\EqnDots{\leaders\hbox to \linewidth{\kern4pt.\kern4pt}\hfill}
\makeatother

\newcommand\mathdotfill[1]{\makebox[#1]{$\mbox{}\kern6pt\boldsymbol \cdot \kern8pt$\xleaders\hbox{$\kern8pt\boldsymbol \cdot \kern8pt$}\hfill}}

\begin{document}

\begin{align}
  \mathcal{H}_{q1} \mathcal{H}_{q2} \mathcal{H}_{q3}\dotsm\mathcal{H}_{qn}0 & =\mfrac{1}{2}H_{q1}\{\mathcal{H}_{q2}\mathcal{H}_{q3}\dotsm\mathcal{H}_{qn}0\}+\mfrac{1}{2} h_{q1} \\ %
                    & =\mfrac{1}{2}H_{q1}\Bigl\{\mfrac{1}{2} H_{q2}[\mathcal{H}_{q3}\dotsm\mathcal{H}_{qn} 0]+\mfrac{1}{2}h_{q2}\Bigr\} +\mfrac{1}{2}h_{q1} \\ %
                    & = \mfrac{1}{2}H_{q1} \mfrac{1}{2} H_{q2}\Bigl [\mfrac{1}{2}H_{q3}(\mathcal{H}_{q4}\dotsm\mathcal{H}_{qn}0)+\mfrac{1}{2}h_{q3}\Bigr]+
  \mfrac{1}{2}h_{q2}+\mfrac{1}{2}h_{q1}\\
                    & = \mathdotfill{\eqboxwidth{M}}\notag \\
                    & = \!\begin{aligned}[t]
  \eqmakebox[M]{$ \mfrac{1}{2^n} H_{q1}H_{q2}H_{q3}..H_{qn}0+ \mfrac{1}{2^n} H_{q1}H_{q2}H_{q3}..H_{qn-1}h_{q1} $} & \\%
  {}+ \mfrac{1}{2^n} H_{q1}H_{q2}H_{q3}\dotsm H_{qn-2}h_{qn-1}+\dots+ \mfrac{1}{2} h_{q1} & %
  \end{aligned}\\
                    & =\sum^n_{j=1} \mfrac{1}{2^j} H_{q0}H_{q1} H_{q2}H_{q3}\dotsm H_{qj-1} h_{qj}
\end{align}
\setcounter{equation}{0}
\begin{align}
  \mathcal{H}_{q_1} \mathcal{H}_{q_2} \mathcal{H}_{q_3}\dotsm\mathcal{H}_{q_{n_0}} & =\mfrac{1}{2}H_{q_1}\{\mathcal{H}_{q_2}\mathcal{H}_{q_3}\dotsm\mathcal{H}_{q_{n_0}}\}+\mfrac{1}{2} h_{q_1} \\ %
                    & =\mfrac{1}{2}H_{q_1}\Bigl\{\mfrac{1}{2} H_{q_2}[\mathcal{H}_{q_3}\dotsm\mathcal{H}_{q_{n_0}}]+\mfrac{1}{2}h_{q_2}\Bigr\} +\mfrac{1}{2}h_{q_1} \\ %
                    & = \mfrac{1}{2}H_{q_1} \mfrac{1}{2} H_{q_2}\Bigl [\mfrac{1}{2}H_{q_3}(\mathcal{H}_{q_4}\dotsm\mathcal{H}_{q_{n_0}})+\mfrac{1}{2}h_{q_3}\Bigr]+
  \mfrac{1}{2}h_{q_2}+\mfrac{1}{2}h_{q_1}\\
                    & = \mathdotfill{\eqboxwidth{M}}\notag \\
                    & = \!\begin{aligned}[t]
  \eqmakebox[M]{$ \mfrac{1}{2^n} H_{q_1}H_{q_2}H_{q_3}\dotsm H_{q_{n_0}}+ \mfrac{1}{2^n} H_{q_1}H_{q_2}H_{q_3}..H_{q_{n-1}}h_{q_1} $} & \\%
  {}+ \mfrac{1}{2^n} H_{q_1}H_{q_2}H_{q_3}\dotsm H_{q_{n-2}}h_{q_{n-1}}+\dots+ \mfrac{1}{2} h_{q_1} & %
  \end{aligned}\\
                    & =\sum^n_{j=1} \mfrac{1}{2^j} H_{q_0}H_{q_1} H_{q_2}H_{q_3}\dotsm H_{q_{j-1}} h_{q_j}
\end{align}

\end{document} 

enter image description here