5

I would like to know if there is any global command that would prevent any page-breaks inside sections. All my sections are short enough. I read some solutions, such as Absolutely, definitely, preventing page break, but I would like an automatic solution.

1 Answer 1

9

Add \filbreak before \section; you can automate it with etoolbox:

\documentclass{article}
\usepackage{etoolbox}
\preto\section{\filbreak}

\usepackage{lipsum} % just for the example

\begin{document}

\section{One}
\lipsum[1-3]

\section{Two}
\lipsum[3-4]

\section{Three}
\lipsum[4-6]

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.