4

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}
2
  • 1
    Align has nothing to do inside multline, you either use one or the other – daleif Jul 16 '16 at 16:09
  • Use align only for what you want and you can align formulas as you see fit. Multline aligns the first line on the left, the last line on the right, and centers the rest. – JPi Jul 16 '16 at 17:34
4

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

4
  • Is there not an easy way to left align equations within multiline? – Al jabra Jul 16 '16 at 20:48
  • 2
    multlineis not done for that. Take a look at the documentation amsldoc.pdf, p.5. – Bernard Jul 16 '16 at 21:43
  • i see blank lines within the scope of align. you don't want them -- they will produce error messages. – barbara beeton Jul 17 '16 at 2:45
  • @barbara beeton: That's right, but actually there's no blank line in the code. The ‘blank lines’ have actually text that's far away in the line, due to the formatting of my editor. I'll change the layout to remove any ambiguity. Thanks! – Bernard Jul 17 '16 at 9:32

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.