3

I am trying to have a conditional page break for a section if there is not enough space in the bottom. To be clear, when an new section starts I want to check if there is enough space (25% of the text height) to start a new section. If there is not enough space then I want to start the new section in a new page. I am trying to use needspace with classicthesis style. Still no change in the output. Here is the relevant part of the code

\usepackage{needspace}
\newcommand*{\conditionalBreak}{%
    \Needspace{5\baselineskip}
    \noindent\section%
}
\begin{document}
\frenchspacing
\raggedbottom
\selectlanguage{american}
\pagenumbering{roman}
\pagestyle{plain}
2
  • 1
    Welcome to TeX.SX! How do you define enough space?
    – user31729
    Jun 23, 2015 at 21:26
  • enough = less than 25% of the text height Jun 23, 2015 at 21:27

1 Answer 1

2

The titlesec package already does that as an option: write in your preamble:

\usepackage[nobottomtitles*]{titlesec}
\renewcommand{\bottomtitlespace}{0.25\textheight}

If the remaining vertical space on the page is less than 25% of the text height, the page will be raged bottom, and the title will be moved to the next page. See details § 3.3, Spacing related tools, of the documentation.

4
  • Worked like a charm! Thanks a lot! Spend more than an hour for this! Jun 23, 2015 at 22:26
  • rirlesec package?
    – user31729
    Jun 23, 2015 at 22:34
  • 1
    i think it should be titlesec. Jun 23, 2015 at 22:35
  • 1
    One of my many typos :o)
    – Bernard
    Jun 23, 2015 at 22:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .