238

The report I'm writting features a lot of long, multiple lines equations. To reduce visual polution I've been using an aligned environment nested inside equation. This way (unlike just using an align environment) I get only a single label for all the lines.

The problem is that so many long equations often need to be broken into two pages, otherwise I get lots of blank vertical space in the document. However the aligned environment does not allow the \displaybreak command.

Is there an alternative way to achieve a pagebreak inside an aligned equation?

Here's a sample ofthe equations I'm using

\begin{equation}
    \begin{aligned}
    ...\\
    ...\\  %I need to pagebreak here
    ...\\
\end{aligned}\end{equation}    
David Carlisle
  • 757,742
Malabarba
  • 6,972
  • 2
    What about the split environment? – Stephan Lehmke Apr 12 '12 at 18:05
  • 3
    About \begin{equation}\begin{aligned}: Would \begin{align}...\notag \\ \label{where you want it} \\ \end{align} (or the split environment as mentioned by Stephan Lehmke) be a possible alternative for you? – Stephen Apr 12 '12 at 18:09
  • @Stephen I'll try it now, but according to AucTeX split can't be broken either. align+\notag seems like a good idea. I wasn't using it because that would involve managing dozens of \notags. But I suppose I could use it only on the problematic equations. – Malabarba Apr 12 '12 at 21:15
  • 6
    if you only want one number you can use the starred form of the environment and use \tag once rather than the unstarred form and use \notag on all but one line – David Carlisle Apr 12 '12 at 22:22

4 Answers4

258

In relation to the comments I want to answer this question.

First of all to allow page breaks inside equations you have to set the command \allowdisplaybreaks. Without setting this one no page break occurs.

Using a simple align-environment. Of course as @DavidCarlisle suggested you can use the star variant to suppress the numbering and set a specific tag by \tag.

The environment split can't handle page breaks.

\documentclass{article}
\usepackage{amsmath}
\usepackage{kantlipsum}
\usepackage{showframe}
\allowdisplaybreaks

\begin{document}
\kant[1-3]
\begin{align*}
    a\\
    b\\
    c\\
    d\\
    e\tag{\stepcounter{equation}\theequation}\\
    f\\
    g\\
    h\\
    i
\end{align*}
\end{document}
David Carlisle
  • 757,742
Marco Daniel
  • 95,681
  • The tag thing is not working for me. I found this \stepcounter{equation}\tag{\theequation}\label{myeq1} working. – Sibbs Gambling Dec 28 '14 at 09:12
  • 1
    It somehow solves my problem of a mildly underfull split equation...it didn't break, but fudge the spaces a little bit...why...? – Troy Woo Feb 09 '15 at 15:42
  • 30
    What's the correct way to set \allowdisplaybreaks locally? Just directly saying it inside a group surrounding the align*? Or inside the align*? – Evgeni Sergeev Jul 29 '17 at 10:57
  • 7
    @EvgeniSergeev see this answer - yes, using a group works – craymichael Jul 23 '19 at 23:23
  • This is just one of the most useful and fundamental commands I've ever discovered and I am astonished by how many thousands of LaTeX lines of code I have already written without knowing it. – ulilaka Mar 30 '21 at 22:29
  • 1
    how can this be used for \begin{equation}\begin{aligned} XXX \end{aligned}\end{equation} – Albert Chen Sep 26 '21 at 15:33
  • Optionally, to identify the second part of the page-broken equation, you can add \tag{\theequation} (that is, without \stepcounter) to some equation line; in the example above you could write h\tag{\theequation}\\. So you will have the equation tag, for example, (7.2) on both pages; otherwise it might feel strange to see an equation chunk without numbering, even more if LaTeX sets some floats in between. – loved.by.Jesus Jan 25 '22 at 11:43
108

Additionally to the above answers, as asked in comments, the command \allowdisplaybreaks from amsmath can be used locally do a display break by using the \begingroup and \endgroup commands:

\begingroup
\allowdisplaybreaks
\begin{align}
    ....
\end{align}
\endgroup

Or simpler syntax (shoutout to GWPR):

{\allowdisplaybreaks
\begin{align}
    ....
\end{align}
}
Mr G
  • 1,359
  • 3
    This answer indicates that without \begingroup and \endgroup, the effect of \allowdisplaybreaks are applied globally. – KaiserKatze Jan 03 '21 at 03:51
  • Best answer, because it doesn't break the rest of the document. For example, I have a bunch of small equation systems which I did not want to break over pages. However, I also had a couple very long ones. This solution comes in handy because it avoids having to manually break pages before every single short equation system that one desires to keep together, because of the latter's small size. – GPWR Apr 22 '23 at 12:00
  • @KaiserKatze Globally or everywhere after the instance of \allowdisplaybreaks? – GPWR Apr 22 '23 at 12:01
  • 1
    Can \begingroup and \endgroup nor be replaced by { and }, respectively? – GPWR Apr 22 '23 at 15:52
  • 1
    @GPWR Can confirm it does work. As another note, on a primitive level the { and } are not equivalent to \begingroup and \endgroup. See here – Mr G May 01 '23 at 03:44
24

Just add the \allowdisplaybreaks command from the amsmath package to the preamble of your document. Works only with the math environments provided by this package. So you can use align.

  • 10
    Isn't this all covered in the other answer? – Johannes_B Nov 05 '17 at 09:13
  • 7
    @Johannes_B To be fair, the other answer doesn't clarify that this only works with the environments from amsmath, so that the solution doesn't work with, for example, a custom math environment. This answer does clarify that. – Chill2Macht Sep 18 '18 at 16:41
  • Also, the \allowdisplaybreaks command accepts an optional value of 1-4 indicating how "allowed" display breaks are. E.g., \allowdisplaybreaks[4] will allow more display breaks than \allowdisplaybreaks[1] will. – inavda Sep 10 '22 at 02:32
2

I am posting my version because it took me some time to figure that out and i hope it will help others also.

\allowdisplaybreaks goes before \begin{document} and it is used only once. Then a very general code example for an equation is the following

\begin{align} 
\sum{...a very large expression...} &= \sum{...another large expression...} \nonumber \\ 
&= \sum{...a result which is also large but needs to be aligned under first "="...} \nonumber \\
{...again a large expression...} &= {...still a large expression...}  \\
&= {... a final large expression...}
\end{align} 

If \nonumber is not used, latex will assign numbers to every line break which for the majority of cases is useless. That worked for me