1

I'm writing lecture notes with exercises. I have a predefined command to write an "exercise header", which is then followed by the exercises. The problem is that sometimes the page breaks right after the header. I've looked up various methods for preventing page breaks, but none of them seem to work.

In the following MWE, the page breaks after the "Exercises" header. If you increase the vspace to 17cm, it breaks after the horizontal line. Neither behavior is good.

\documentclass{book}

\newcommand{\Exercises}{\par \vspace{4ex plus 2ex minus 0ex}\hfil\rule{300pt}{0.5pt}\hfil\par
\vspace{3ex plus 2ex minus 0ex}%
\noindent\textbf{\Large{Exercises.}}\medskip}

\newtheorem{prob}{}[section]

\begin{document}

Some text.

\vspace{16cm}

Some other text.

\Exercises

\begin{prob}
  Exercise 1.
\end{prob}

\end{document}

0 Answers0