如何从knitr rmarkdown PDF中分离Title Page和Content of Page页面?

时间:2015-06-22 05:08:39

标签: r

任何人都知道如何分隔“标题页”和“目录”页面? 从这段代码:

---
title: "Title Page"
output: 
  pdf_document:
      toc: true
      number_sections: true
---

上面的几行代码创建了标题和目录,但标题封面和目录没有分离。

通过添加乳胶符号\newpage\tableofcontents

,我找到了另一种选择
---
title: "Title Page"
output: 
    pdf_document
---

\centering
\raggedright
\newpage
\tableofcontents

# header 1
```{r}
summary(cars)
```

## header 2
```{r, echo=FALSE}
plot(cars)
```

## header 3
lore ipsum 

# header 4
lore ipsum

是否有办法在不必使用套餐\newpage\tableofcontents并在以下区块的某处使用rmarkdown

---
title: "Title Page"
output: 
    pdf_document:
        toc: true
---

1 个答案:

答案 0 :(得分:8)

我在visibility

下的选项中使用了三个乳胶文件
includes:

--- title: "Title Page" output: pdf_document: toc: true number_sections: true includes: in_header: latex/header.tex before_body: latex/before_body.tex after_body: latex/after_body.tex --- 文件包含before_body之后您想要的所有选项和标题选项,但是在您开始编写文档正文之前。在该文件中,只需放置\begin{document},就像这样:

\newline

那就是它! \newpage 文件中没有其他内容。这应该有用。

现在,如果我只能垂直居中标题页......