[Tex/LaTex] Allow page breaks in a gather environment with a nested align

alignamsmathdisplaybreakdisplaystyle

I have two consecutive lists of equations, the second of which is quite long (16 lines with no reasonable way to shorten it apparent). Because the center alignment of gather looks ugly in this case, I've nested an align environment in order to align the various equations in a sensible way.

Unfortunately, the second list is long enough that I would like to allow it to break over two pages to avoid the massive white space that results when the entire list floats to the next page. I'd like to let TeX handle it automatically rather than forcing the break with \displaybreak.

The super simplified MWE (without alignment characters since only the length of the environment, and not the specific alignment, seems to matter):

\documentclass[12pt]{article}
\usepackage{amsmath}
\allowdisplaybreaks
\usepackage[bottom]{footmisc} % Needed to avoid strange behavior of the footnote
\linespread{1.55}
\begin{document}

Here is my first gather with nested align
\begin{gather}
    \begin{align}
    1\\
    2\\
    3\\
    4\\
    5\\
    6\\
    7\footnotemark
    \end{align}
\end{gather}
\footnotetext{Footnote text.} 

Here is my second gather with nested align:
\begin{gather}
    \begin{align}
        1\\
        2\\
        3\\
        4\\
        5\\
        6\\
        7\\
        8\\
        9\\
        10\\
        11\\
        12\\
        13\\
        14\\
        15\\
        16
    \end{align}
\end{gather}

\end{document}

Now, there's at least one problem with this attempt that I'm aware of:

I shouldn't use align: as explained in this answer to "How to use \displaybreak" align environments are unbreakable and so \allowdisplaybreaks and \displaybreak have no effect. The suggestion there is to use align*.

Unfortunately, the same problem arises with a simple substitution of align* for align in the preceding MWE (also it's quite annoying to not have automatic numbering).

How can I achieve an aligned list of numbered equations (that are easy to cross-reference and, if possible, automatically tagged) that will break across pages when length and context requires?

Edit 1

As juanuni points out in the comments, the gather environment is unnecessary here. The reason it is there is somewhat idiosyncratic. In the document this problem arose in I have custom gather and equation environments with distinct counters and tag formats. Being a bit lazy, I just used the custom gather environment to pass the relevant counter (not equation's counter) and tag format to the nested align.

Edit 2 (Now with puzzlement!)

Well, a combination of shame and insomnia prompted me to stop being lazy and just create the custom align environment. Interestingly, when I use my custom align without nesting it in the custom gather, I get the desired result: the long align environment breaks across the page.

But this confuses me. My custom align (along with the new counter) is defined as follows:

\newcounter{defcounter}
\makeatletter
\newenvironment{defalign}{%
  \let\c@equation\c@defcounter% switches to defcounter
  \renewcommand\theequation{D.\arabic{equation}}
  \align}
  {\endalign}
\makeatother

But the the answer linked above suggests that what I just did shouldn't work. Why does it?

Best Answer

\allowdisplaybreaks doesn't work simply because you are nesting an align inside a gather environment. This causes the align to be wrapped in an unbreakable box. The solution is obvious: remove the gather environment, which is unneeded.

But the align itself isn't generally wrapped in an unbreakable box. This is always true for the following amsmath's environments:

  • split
  • aligned
  • gathered
  • alignedat

Note that the first three are meant to be used inside another math environment like equation.

In regards of your latest question, the answer you refer to states that aligned inside equation* is unbreakable and the suggestion is to use align* instead. Nowhere is stated that align is unbreakable.