# Supress page breaks before headings, allow orphans

I am trying to create a simple outline document (based on scrbook), that contains just headings (chapter, section, ...) and a few notes inbetween. For that, I removed the clearpage before a new chapter, and adjusted the heading spacings with the titlesec package. Later, I'll comment out the modification and flesh out the outline to be the final document.

I's looking pretty good so far, but Latex insists in inserting rubber between paragraphs and before and after sections. Setting `\raggedbottom` fixed that, but I still get some section headings pushed to the next page, although there would be enough space on the current page.

I'd like it to put as much text as possible on the current page, even if the page ends with a heading. I tried

``````\widowpenalty=0
\clubpenalty=0
``````

but that didn't have any effect. What can I try?

-
Sounds like you're trying to create a table of contents. You could create a fictitious document via `\includeonly{<filename>}`. This file contains chapter and subsections but your final document need only show the table of contents. Otherwise, why doesn't just using nested lists suit your purpose? –  A.Ellett Nov 26 '12 at 14:31
Did you try adding also `\makeatletter\@clubpenalty=0 \makeatother`? –  egreg Nov 26 '12 at 14:37
@A.Ellett: That's what I tried first, just creating the table of contents. However, I want to have some arbitrary text (comments) between the headings. Also, I want to be able to "flesh out" the comments and then have my proper document; writing lists in latex is cumbersome, and I'd have to rewrite the outline with sections afterwards anyway. –  jdm Nov 26 '12 at 14:44
@egreg: That didn't work, unfortunately. –  jdm Nov 26 '12 at 14:48
@lockstep: The solution you posted (concerning nobreak) worked, why did you delete it? If you post it again, I could accept it. I'm also wondering if there is a cleaner way to do it, e.g. with something like `\patchcmd{\section}{...}`, that really only affects the section headers. –  jdm Nov 26 '12 at 15:00

``````\usepackage[compact]{titlesec}