How to add \ newpage to Rmarkdown in a smart way?

I wonder if it is possible to simply use the LaTeX \newpage in R markdown v2 differently than this:

 ```{r, results='asis', echo=FALSE} cat("\\newpage") ``` 

I am creating pdf_output. If anyone has any ideas, please feel free to comment :)! Thanks

I create pdf as follows:

 --- title: " " author: " " date: "2014" output: pdf_document: includes: in_header: naglowek.tex highlight: pygments toc: true toc_depth: 3 number_sections: true keep_tex: true --- 
+65
r r-markdown
Aug 11 '14 at 9:56
source share
1 answer

Just \newpage or \pagebreak will work, for example.

 hello world \newpage ```{r, echo=FALSE} 1+1 ``` \pagebreak ```{r, echo=FALSE} plot(1:10) ``` 

This solution assumes that you have knitted a PDF. For HTML, you can achieve a similar effect by adding the <P style="page-break-before: always"> . Note that you probably won’t see page breaks in your browser (HTML files do not have pages as such), but the print layout will have it.

+98
Aug 11 '14 at
source share



All Articles