0

This script:

\documentclass{report}
\usepackage{lipsum}
\begin{document}
\lipsum[1-5]
Examples:
\\\nopagebreak
example 1\\
example 2\\
example 3
\end{document}

unfortunately introduces an awkward page break between "Examples:" and "example 1":

enter image description here

I attempt to tackle the problem by using \nopagebreak however, my solution doesn't work. How to fix?

  • the \nopagebreak in that position is preventing a break between example1 and example2, but you should not need such a command in-document. – David Carlisle Apr 6 at 18:36
4

That is not "between paragraphs" that is a single paragraph (\\ never ends a paragraph).

Do not use \\ and use a section heading like \section*{Examples} latex does not allow page breaks after a section heading

  • \section does not seem right here as it has a specific formatting and goes to TOC. Can I use \par instead of `\`? – Viesturs Apr 6 at 18:18
  • 4
    \section* doesn't go in the toc by default and has user or class defined formatting so you can make it use whatever format you want. You almost never need to use \par in a document as it is a simpler (and equivalent) to simply leave a blank line. – David Carlisle Apr 6 at 18:20
  • \section* does not go to the ToC. – Peter Wilson Apr 6 at 18:20

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.