1

I'm trying to create titles for pieces of text that won't appear as the last element at the bottom of the page. I haven't been able to find a method to prevent page breaks directly below the title. How to do this? enter image description here

Code:

\documentclass[12pt,titlepage,twoside]{book}
\usepackage[paperwidth=30cm,paperheight=11cm]{geometry}
\usepackage{lipsum}

\newlength\meetingtopsep
\setlength\meetingtopsep{2ex plus0.8ex minus0.5ex}
\newcounter{meetingno}[section]
\renewcommand\themeetingno{\Roman{meetingno}}
\newcommand\meeting{
    \vspace{\meetingtopsep}
    \refstepcounter{meetingno}
    \begin{center}
        \large{Meeting \themeetingno}
    \end{center}
}

\begin{document}
\section{ABC}
AAAaaa
\meeting
\lipsum[2-2]
\meeting
\lipsum[1-1]
\end{document}
3
  • 3
    size commands don't take an argument so ` \large Meeting` not ` \large{Meeting}` but you should use a heading here. \subsection (if meetings are numbered within section) or perhaps a new heading based on \part if not. Commented Jun 28 at 0:56
  • @DavidCarlisle - chapters, sections, subsections are present in the book. This book has some pieces of text that appear independently from regular sectioning ("Meetings" and "Trials"). This is an old book. Idea from a while ago: Should I try using tcolorbox to solve my problem?
    – forrest
    Commented Jun 28 at 6:04
  • There is also the needspace package. Commented Jun 28 at 12:45

1 Answer 1

2

enter image description here

You can define it as a heading so latex takes care of avoiding bad page breaks, I defined it to be level -1 like \part so it's not really in the normal sectioning heirarchy.

\documentclass[12pt,titlepage,twoside]{book}
\usepackage[paperwidth=30cm,paperheight=11cm]{geometry}
\usepackage{lipsum}

\newlength\meetingtopsep
\setlength\meetingtopsep{4ex plus0.8ex minus0.5ex}% increased as no longer adding `\begin{center} space
\newcounter{meetingno}[section]
\renewcommand\themeetingno{Meeting \Roman{meetingno}}

\makeatletter
\newcommand\meeting{% you need this %
                      \@startsection{meetingno}{-1}{\z@}%
                      {-\meetingtopsep}%
                      {2ex \@plus .5ex}%
                      {\normalfont\normalsize\bfseries\centering}%
                      {}%  
}
\makeatother
\begin{document}
\section{ABC}
AAAaaa
\meeting
\lipsum[2-2]
\meeting
\lipsum[1-1]
\end{document}

You must log in to answer this question.

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