3

I redefine \subsection in the article class

    \renewcommand\subsection{%
\penalty-8888
%\pagebreak[3]
\@startsection {subsection}{1}{0em}{1\parskip plus 1\parskip minus 1\parskip}{1\parskip plus 1\parskip minus 1\parskip}{\centering\rmfamily\bfseries\scshape}%
}

and at some point in my text, I have a subsection that is near the bottom. With pagebreak[3] enabled and \penalty commented, the subsection begins on the next page but the previous text is dilated towards the bottom. This is expected. Idem, if I use the option with \penalty-8888.

If I put a \newpage just before my subsection, I get a blank space at the bottom of the page. This is what is expected and what I want but only if it is necessary (say at two-third of the page); is it possible to moderate its triggering with an argument like \pagebreak has ?

PS: actually, I redefine the \subsubsection as well and I have the same problem. I redefine the \section too, but I put explicitly a \newpage in it so all is good.

3

You probably want to replace

\penalty-8888

by something like

\par\vspace{0pt plus .3\textheight}\pagebreak[3]\vspace{0pt plus -.3\textheight}

this will allow space to stretch up to 30% of text height before a page break so the page is short, but if the break doesn't happen the two vspace cancel out and no extra space is added.

or simpler but a bit stretchier just

\filbreak
  • Your value seems to work but right on the first page, there is the first subsection taking (a bit less than) half the textwidth and a footnote taking about 1/10th of the textwidth; the second subsection goes to the next page already. SO the 0.3 in the formula does not mean that it is encouraged to go to the next page if the remaining space is less than a third of the textwidth, does it not ? Can you comment a bit more ? When you mention "this will allow the space..." what space are you talking about ? – user50260 Apr 26 '14 at 6:34
  • Your code has an odd effect on my tex file. I put a page style inside the definition of \section and a different one inside \subsection because I want two different page styles if the first subsection, after a section, begins at a different page (than the section it belongs to). Your code breaks that as it seems that it leave some marker to tell latex that the page should have been here, but it is not. When a first subsection should have happened to be on the same page as the section, but actually get to the other page, I get the style for the subsection instead of the one for the sections. – user50260 Apr 26 '14 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy