3

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.

0

1 Answer 1

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

5
  • but the un-aligned part may be a long and complicated mathematical equation. Commented Sep 8, 2014 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
    Commented Sep 8, 2014 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. Commented Sep 8, 2014 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
    Commented Sep 8, 2014 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. Commented Sep 8, 2014 at 8:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .