Page Layout ⇒ not enough space for chapter
not enough space for chapter
sometimes happens to me, that a chapter title is at the very bottom of the page and the content of the chapter is on the new page.
This does not look nice. Is there any way, how to tell latex to move the whole chapter to the new page, if there is not enough space in the current page?
I can use \pagebreak, but this "manual" aproach can be tricky...
also I googled samepage, but I am looking for something that can be applied globally on the whole document
thanks a lot
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
not enough space for chapter
\chapter
. Do you mean \section
? Or which command shows the problem here?Stefan
Re: not enough space for chapter
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
not enough space for chapter
\chapter
starts a new page by itself and is always on top. Normally a section heading should also not be at the end of a page. Do you have a small example document showing such a behavior, with your class and your settings resp. preamble?Stefan
Re: not enough space for chapter
but here is a sample document with my preamble and it shows what I want to change in latex settings - there is a section with only 2 lines of content and then a page break
- Attachments
-
- sample.tex
- (2.85 KiB) Downloaded 267 times
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
not enough space for chapter
Well, in any case you could use the

Code: Select all
\usepackage{needspace}
...
\needspace{4\baselineskip}
\section{test}
Stefan
not enough space for chapter
thanks a lot
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
not enough space for chapter
Code: Select all
\usepackage{needspace}
\usepackage{etoolbox}
\patchcmd{\section}{\@startsection}{\needspace{4\baselineskip}\@startsection}{}{}
Re: not enough space for chapter
