[Tex/LaTex] Multiline equation, label once and support page break

alignequationspage-breaking

I want a multiline equation that labeled once and support page break. If I choose

\begin{align}\begin{split}
balabala\\
balabala
\end{split}\end{align}

then the split makes it unable to support page break. I understand that I can use align together with nonumber but I want a smarter way that I don't have to worry. It doesn't matter where the label appears.

A simplified question would be: is there any way that automatically set label on the first line and at the same time the whole equation allows page break?

Best Answer

If I understand you correctly, this is what you are looking for: Some aligned equations that are numbered once in the very beginning (first line) and allow page-breaks? The following code does that.

It uses the align* environment to suppress automatic equation numbering. I wrote the short macro \numberthis which does number the current line of an align* environment and updates the equation counter. Then I patched the align* environment to use it and number the first line. As others mentioned, you also need \allowdisplaybreaks.

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{etoolbox}

\usepackage{lipsum}

\newcommand{\numberthis}{\refstepcounter{equation}\tag{\arabic{equation}}}
\expandafter\appto\csname align*\endcsname{\numberthis}
\allowdisplaybreaks

\begin{document}
\begin{align*}
    (a+b)^2&=a^2+2ab+b^2\\
    (a-b)^2&=a^2-2ab+b^2\\
    a^2-b^2&=(a+b)(a-b)
\end{align*}
\lipsum[1-3]
\begin{align*}
(a+b)^2&=a^2+2ab+b^2\\
(a-b)^2&=a^2-2ab+b^2\\
a^2-b^2&=(a+b)(a-b)\\
a&\\
b&\\
c&
\end{align*}

\end{document}

result

Related Question