Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 9 down vote accepted

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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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