35

I would like to have two displayed equations, broken by a short paragraph, but with aligned equal signs (as if using the align environment). Is there some way to "break" the align environment temporarily?

Stefan Kottwitz
  • 231,401
Kristen
  • 5,003

4 Answers4

36
\begin{align}
a &= 1 \\
\intertext{and}
b &= 2
\end{align}
David Carlisle
  • 757,742
Leo Liu
  • 77,365
23

An alternative which requires less vertical spacing than \intertext is \shortintertext, provided by the mathtools package:

\documentclass{article}
\usepackage{mathtools}% automatically loads amsmath
\begin{document}
\begin{align}
    ax + b &= 0 \\
\shortintertext{and}
    ab &= x
\end{align}
in comparison with
\begin{align}
    ax + b &= 0 \\
\intertext{and}
    ab &= x
\end{align}
\end{document}

output

Moriambar
  • 11,466
Stefan Kottwitz
  • 231,401
11

\intertext and \shortintertext are the correct solution if you are able to place all the content within one align environment. If for some reason you need to have alignment across two different align type environments, you can use

\makebox[<length>][<l|r|c>]{<text>}

to place the <text> in a box of width <length> and placed within that box with l, r, or c alignment. The appropriate <length> can be determined via \widthof from the the calc package.

Below I have defined \WidestLeftHandSide and \WidestRightHandSide, and applied r alignment to the left hand side of the first equation in the second align, and an l alignment to the right hand side. This adjustment only needs to be applied once to both side. This yields:

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{calc}

\newcommand{\WidestLeftHandSide}{\tan^2 \theta + \sin^2 \theta + \cos^2 \theta}% \newcommand{\WidestRightHandSide}{1 + \tan^2 \theta}%

\begin{document} \begin{align} \tan^2 \theta + \sin^2 \theta + \cos^2 \theta &= 1 + \tan^2 \theta\ \implies \cos^2 \theta &= 1 - \sin^2 \theta \end{align} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris diam quam, cursus vel porttitor eget, posuere non mauris. Suspendisse potenti. Sed in vestibulum augue. Nullam eu est ante. \begin{align} \makebox[\widthof{$\WidestLeftHandSide$}][r]{$E$} &= \makebox[\widthof{$\WidestRightHandSide$}][l]{$mc^2$}\ F &= ma \end{align} \end{document}

Peter Grill
  • 223,288
4

In Plain: $$ \eqalignno{ ax+b&=1\cr\noalign{\hbox{and}} ab&=x } $$\bye.

morbusg
  • 25,490
  • 4
  • 81
  • 162