[Tex/LaTex] How to avoid page breaks locally in aligned equations, with \allowdisplaybreaks enabled

alignamsmathequationspage-breaking

I want page breaks to be allowed in my aligned equations, so I set \allowdisplaybreaks after reading Is it possible to pagebreak aligned equations?

There is one place in my document where I don't want a page break. It looks like

\documentclass{article}

\usepackage{amsmath}
\allowdisplaybreaks

\begin{document}
Text
\vspace{52em}
\begin{align*}
& a long formula \\        % I don't want a page break here
& + spanning two lines
\end{align*}

\end{document}

I tried using \nopagebreak at various locations, but I still get the page break

Best Answer

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

\begin{document}
Text
\vspace{52em}
\begin{align*}
& a long formula \\*    % the \\* command prohibit a page break after a given line
& + spanning two lines
\end{align*}
\end{document}

enter image description here