2

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}
  • 1
    Welcome to TeX.SX! How do you define enough space? – user31729 Jun 23 '15 at 21:26
  • enough = less than 25% of the text height – Samiul Alam Anik Jun 23 '15 at 21:27
1

The titlesec package already does that: write in your preamble:

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

If the remaining vertical space on the page is less than 25% if 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.

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

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.