I am getting a page break in the middle of my document for reasons I cannot explain. I condensed the code down to the following extremely simple MWE that reproduces the issue.
\documentclass{article}
\usepackage{lipsum}
\begin{document}
{\LARGE Title}
\section{Section 1}
\subsection{Subsection 1}
\lipsum[1][4]
\subsection{Subsection 2}
\lipsum[1][5]
\subsection{Subsection 3}
\lipsum[1][9-10]
\section{Section 2}
\subsection{Subsection 4}
\lipsum[1][6-11]
\section{Section 3}
\subsection{All remaining sections/subsections need to be here...}
\subsection{...in order to generate the mystery page break}
\subsection{It seems if you delete...}
\subsection{...any of the remaining subsections...}
\subsection{...then it makes the page break vanish.}
\section{Section 4}
\subsection{Another subsection}
\subsection{And another}
\subsection{And another}
\section{Section 5}
\end{document}
The output looks like this:
Where is that page break coming from?
It seems especially weird to me that if I delete, for example, Section 5 from the document, the page break goes away. Presumably, that is because without Section 5 the entire document would fit onto a single page. But, so what? Wouldn't that also suggest that it makes sense to break the page right before Section 5?
All of this suggests to me that somehow LaTeX is doing some sophisticated decision-making about the best place to break the pages. If so, then this must be documented someplace, I suppose. But it seems hard to imagine what logic would lead to a break right in the middle of the first page like that.
Can anyone help to clarify?
