# Avoiding page breaks after section headings followed by lists

I am writing a reference book in which every section heading is followed by an itemized list. I often get page breaks after the section heading and just one or two of the list items. In such cases I would like the heading to move to the next page. I tried all the solutions mentioned at Avoiding page breaks shortly after section/subsection headings, but none of them had any effect. It seems like these methods apply only when a paragraph follows the heading. What can I do in my case?

• Your title suggests that you were getting a page break between the heading and the list. That should never happen. The text seems to imply that the break was after an item, which can happen and jfbu's answer is the answer for that case – David Carlisle Oct 26 '18 at 13:06
• Sorry - text is right; please parse the title as "Avoiding page breaks after (section headings followed by lists)". – KeithB Oct 26 '18 at 13:46

I would use the needspace package.

\documentclass[a4paper]{article}

\usepackage{geometry}
\usepackage{needspace}
\begin{document}
\vspace*{17.25cm}% try 17.26cm and see the whole section moving to next page

\needspace{7\baselineskip}
\section{Foo}

\begin{itemize}
\item A

\item B

\item C

\item D
\end{itemize}
\end{document}