4.1 Insert page breaks

When you want to break a page, you can insert the command \newpage in the document. It is a LaTeX command, but the rmarkdown package is able to recognize it for both LaTeX output formats and a few non-LaTeX output formats including HTML,5 Word, and ODT. For example:

---
title: Breaking pages
output:
  pdf_document: default
  word_document: default
  html_document: default
  odt_document: default
---

# The first section

\newpage

# The second section

This feature is based on Pandoc’s Lua filters (see Section 4.20). For those who are interested in the technology, you may view this package vignette:

vignette("lua-filters", package = "rmarkdown")

  1. For HTML output, page breaks only make sense when you print the HTML page, otherwise you will not see the page breaks, because an HTML page is just a single continuous page.↩︎