问题描述
我想知道是否可以在 R markdown v2 中以与此不同的方式简单地使用 LaTeX \newpage
命令:
I wonder if one could simply use LaTeX \newpage
command in R markdown v2 in a different way than this:
```{r, results='asis', echo=FALSE}
cat("\\newpage")
```
我生成 pdf_output.如果任何人有任何想法,请不要犹豫发表评论:)!谢谢
I produce pdf_output.If any1 has any idea please do not hesitate to comment :) ! Thanks
我像这样创建 pdf:
I create pdf like this:
---
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
---
推荐答案
Simply \newpage
或 \pagebreak
即可,例如
Simply \newpage
or \pagebreak
will work, e.g.
hello world
\newpage
```{r, echo=FALSE}
1+1
```
\pagebreak
```{r, echo=FALSE}
plot(1:10)
```
此解决方案假定您正在编织 PDF.对于 HTML,可以通过添加标签 <P style="page-break-before: always">
来达到类似的效果.请注意,您可能不会在浏览器中看到分页符(HTML 本身没有页面),但打印布局会有.
This solution assumes you are knitting PDF. For HTML, you can achieve a similar effect by adding a tag <P style="page-break-before: always">
. Note that you likely won't see a page break in your browser (HTMLs don't have pages per se), but the printing layout will have it.
这篇关于如何以智能方式在 Rmarkdown 中添加 \newpage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!