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?

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

1 Answer 1

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

3
  • \section does not seem right here as it has a specific formatting and goes to TOC. Can I use \par instead of `\`?
    – Viesturs
    Commented Apr 6, 2019 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. Commented Apr 6, 2019 at 18:20
  • \section* does not go to the ToC. Commented Apr 6, 2019 at 18:20

You must log in to answer this question.

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