By default, LaTeX allows a page break after the first two lines of paragraphs following section/subsection headings. How can I enlarge this minimum to, say, three lines or 10 percent of the value of \textheight?
|
|
||||
|
|
|
There may be a generalisable mechanism: Using e-TeX and its
UPDATE: egreg has written a detailed explanation of |
|||||||||||||||||
|
|
You could use needspace. With a bit calculations and tests it shouldn't be too difficult to find sensible values:
|
|||
|
|
|
I solved this with the needspace and titlesec packages, as in:
\usepackage{titlesec}
\usepackage{needspace}
...
\titleformat{\section}
{\needspace{1in}\Large\bfseries}{\thesection}{1em}{}
Hardcoding 1in is crude -- should probably be a multiple of line height. At any rate, this works great in my documents without the need for hand tuning each section. |
|||||||||||||
|
|
I haven't tried it myself, but perhaps you can use the needspace package for this. Be sure to heed the FAQ warning about how this may confuse tex, even if you do succeed in preventing page breaks between the lines (eg, ending up with an overfull page leaving those lines jutting out of the bottom of the page). |
|||
|
|
|
||||
|
|
There isn't a generalisable mechanism. Single last lines or single first lines of a paragraph, appearing at the beginning or the end of a page, are known as 'widows' and 'orphans/clubs' (I think they're that way round). TeX has a mechanism for avoiding, or at least penalising, widows and orphans, but it's specialised for this case of keeping the first or last two lines together, and it can't be extended to three lines or more. There may be a way of addressing this by doing scary output routine gymnastics, but that would be a very exotic thing to do. |
|||||||
|
