This question already has an answer here:

I'm trying to create my document with lots of section. However, after the document is compiled by pdfLaTeX, the document showed like this: The document goes out of boundary of paper

\section{aaa}  % * a lots of time

How to make sure the sections doesn't goes out of bond and create new page automatically?

marked as duplicate by David Carlisle sectioning Jun 12 at 14:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Place some text between the section commands. – leandriis Jun 12 at 13:37
  • 1
    Welcome to TeX.SX! Yes, that's the expected behaviour. LaTeX prevents page-breaking after all section titles. It would be awkward to have a section title at the bottom of the page and the text starting on the next page, thus this is the way it is. In normal documents this shouldn't be a problem. – Phelype Oleinik Jun 12 at 13:40
  • When you are testing with code like this, always remember to add text to each section. – daleif Jun 12 at 13:49