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:

  1. ---
  2. title: Breaking pages
  3. output:
  4. pdf_document: default
  5. word_document: default
  6. html_document: default
  7. odt_document: default
  8. ---
  9. # The first section
  10. \newpage
  11. # 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:

  1. 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.↩︎