Take the 2-minute tour ×

I am using LyX and try to avoid the occurence of short text sections at the end of a page which start with a chapter/section etc. Is it possible to add a preamble line which can tell LyX that if a section only has less than e.g. 3 lines in the bottom of a page, it should be moved to the next page?

The way I solve this at the moment is to wait until my report is finished and then add \newpage where this occurs, but it's starting to bug me since I have quite large reports and feel that I loose a bit of control over the documents structure.

Here's an example: MWE

excerpt from generated pdf

share|improve this question
Anything that needs to be zipped up does not qualify as a MWE: meta.tex.stackexchange.com/questions/228/… –  StrongBad Oct 10 '12 at 10:08
sorry, I didn't know that. Edited to just be the .lyx file. Thank you for the heads up –  Wilhelmsen Oct 10 '12 at 10:54
add comment

1 Answer

Assuming you mean lines and not sentences, you should be able to do this with the needspace package. The concept is as follows


\section{First section}

\section{Second section}
An extra line

A second extra line

\section{Third section}


In this case if there is not 6 baselineskips worth of space, the section gets moved to a new page (I chose 6 so I did not have to fiddle with the spacing to get things to move). It is not a perfect solution since I needed to add two lines to get the section to jump and not a single line.

You should be able to modify \section (and maybe \subsection etc) to include \needspace.

share|improve this answer
add comment

Your Answer


