我正在 rmarkdown 中编写一个投影仪演示文稿,并使用 knitr 将其转换为 pdf。我想在 header1 级别定义部分,例如# Introduction
,然后有一个标题为其他内容的幻灯片,例如## Introducing my brilliant research
.让 header1 级别定义部分很好,因为部分的名称可以显示在某些投影仪主题的幻灯片标题中,这就是我包含它的原因。
但我不希望 rmarkdown 插入一张幻灯片,它只是说部分之间的部分名称,目前正在这样做。有没有办法不打印部分之间带有部分名称的幻灯片?我以为slide_level
会控制这种行为,但它似乎没有(或者我可能用错了)。
可以使用以下代码获得我的问题的最小可重现示例:
---
title: "Test Pres"
author: "Professor Genius Researcher"
date: "24 February 2017"
output:
beamer_presentation:
slide_level: 2
theme: "Singapore"
colortheme: "rose"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
# Markdown Intro
## R Markdown
This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.
# Using Bullets
## Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
# Including Chunks
## Slide with R Output
```{r cars, echo = TRUE}
summary(cars)
```
## Slide with Plot
```{r pressure}
plot(pressure)
```
目前,此代码生成的幻灯片显示 Markdown Intro、Using Bullets 和 Include Chunks。我想要那些标记省略部分的幻灯片。这可能吗?
最佳答案
创建一个新的 Latex 模板,在其中从序言中删除此部分:
\AtBeginSection[]
{
....
}
将此 latex 模板与您的 .Rmd 文件放在同一文件夹中,并使用
template: mytemplate.tex
在 Rmd Yaml 前端内容中引用它。如解释 here .
关于rmarkdown 投影仪演示 : how to not print section slides?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42439763/