How to add a page break in word document generated by RStudio & markdown

With the help of John MacFarlane and others on the pandoc google group, I put together a filter that does this. Please see: https://groups.google.com/forum/#!topic/pandoc-discuss/FzLrhk0vVbU In short, the filter needs to look for something to replace with the openxml for pagebreak. In this case \newpage is being replaced with <w:p><w:r><w:br w:type=\"page\"/></w:r></w:p> This allows for a single latex markup to be interpreted for both pdf and word output. Joel


Added: To insert a page break, please use \newpage for formats including LaTeX, HTML, Word, and ODT.

https://bookdown.org/yihui/rmarkdown-cookbook/pagebreaks.html

Paragraph before page break.

\newpage

First paragraph on a new page.

Previously: There is a way by using a fifth-level header block (#####) and a docx template defined in YAML.

After creating headingfive.docx in Microsoft Word, you select Modify Style of the Heading 5, and then select Page break before in the Line and Page Breaks tab and save the headingfive.docx file.

Page break before

---
title: 'Making page break using fifth-level header block'
output: 
  word_document:
    reference_docx: headingfive.docx
---

In your Rmd document, you define reference_docx in the YAML header, and now you can use the page-breaking #####.

Please see below.

https://www.r-bloggers.com/r-markdown-how-to-insert-page-breaks-in-a-ms-word-document/