Suppose I have multiple align environments which consist of multiple lines of equations. How do I align the separate align environments to the = sign?

What I want to achieve:

first we do the multiplication (text)
a = 1x2 + 2x3 + 4 (mathmode)
  = 2+6+4 (mathmode)
now we perform the addition (text)
a = 8+4 (mathmode)
  = 12 (mathmode)

The above is of course a simplified example. What I want to do ultimately is to define a few large matrices. I want each matrix to be aligned to the = sign, to number each matrix individually, and if there isn't enough space it will continue to the next page (if I just one single align environment to contain all matrices then I find out if there isn't enough space remaining on a page if will just start the whole block on a new page, leaving lots of unwanted empty space on the original page).

So, what's the best way to do it?

  • 2
    \allowdisplaybreaks in the preamble allows for pagebreaks in aligns. You can add text between lines of an align or gather using \intertext, but it seems there isn't real support for this in LyX: lyx.org/trac/ticket/723 – Torbjørn T. Sep 29 '16 at 10:27
  • You could post this as an answer because it is the correct one. – G.M. Oct 2 '16 at 13:25

Now amsmath does have support for this kind of thing, it involves \allowdisplaybreaks/\displaybreak and \intertext, the former two for page breaks, the latter for text between lines of an align:

  • Placing \allowdisplaybreaks in the preamble will allow for page breaks in all multiline display math environments from amsmath.
  • Adding \displaybreak before a specific \\ in an align allows for a pagebreak after that specific line.
  • \intertext{text} should be placed inside an align environment after a \\, and places text on a "normal" text line, continuing the alignment after it.

Hence, your simple example could be written in LaTeX as

first we do the multiplication (text)
a &= 1\times 2 + 2\times 3 + 4 \\
  &= 2+6+4 \\
\intertext{now we perform the addition}
a &= 8+4 \\
  &= 12 

In LyX you're a bit worse off though, as \intertext isn't currently supported in the GUI, see feature request at http://www.lyx.org/trac/ticket/723. I can't think of any good workarounds at the moment, writing the whole aligns in ERTs is probably not of interest for you.

But allowing for page breaks in all align environments is as you see easy, just go to Document --> Settings --> LaTeX preamble and add \allowdisplaybreaks.

|improve this answer|||||

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.