2

Here is a block of LaTeX that contains an un-aligned equation between 2 aligned equation blocks.

\begin{gather*}
    \begin{align*}
        a &= b (c + d)&\\
          &= bc + bd&
    \end{align*}\\
    [ \text{as } bc = zx \text{, and } bd = zy \text{, (this may be a long description occupying one line)} ]\\
    \begin{align*}
          &= zx + zy&\\
          &= z(x + y)&
    \end{align*}\\
\end{gather*}

The output looks like :

           a = b(c + d)
             = bc + bd
[as bc = zx, and bd = zy, (this may be a long description occupying one line)]
    = zx + zy
    = z(x + y)

You should notice that the "equal" sign in the second aligned block is not placed in the same position as the first aligned block.

I want to know that is there a way to align the "equal" sign in the second aligned block so that it is placed at the same position as the first aligned block. i.e. It should look like :

           a = b(c + d)
             = bc + bd
[as bc = zx, and bd = zy, (this may be a long description occupying one line)]
             = zx + zy
             = z(x + y)

Thanks for any suggestion.

4

You can use \intertext to add a line of text between aligned blocks.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{gather*}
    \begin{align*}
        a &= b (c + d)&\\
          &= bc + bd&
     \intertext{as $bc = zx$, and  $bd = zy$, (this may be a long description occupying one line)}
          &= zx + zy&\\
          &= z(x + y)&
    \end{align*}\\
\end{gather*}
\end{document}

enter image description here

  • but the un-aligned part may be a long and complicated mathematical equation. – user1129812 Sep 8 '14 at 6:35
  • 2
    If it is a long complicated mathematical expression that does not fit on a lintel line, probably you should write in in a different way, not interwinding the two. – Guido Sep 8 '14 at 6:38
  • \intertext{} is a text mode environment. It seems a bit difficult to align content if we turn it into "displaystyle" math mode using $$. However, "textstyle" math equation content seems align OK. Perhaps it may be a solution for not too complicated inter equation. – user1129812 Sep 8 '14 at 7:40
  • If you have to interleave a displayed formula, how do you know that the block below is not a continuation of the interleaved formula? Also if is very long, the alignment can be in a different page as well. This is why I suggested to present the computation in a different way. – Guido Sep 8 '14 at 7:47
  • It seems that we could insert display style math by using \intertext{e.g. $\displaystyle \sum_{n=1}^m x^2 $}. Then this would solve my problem. Thanks. – user1129812 Sep 8 '14 at 8:09

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.