rmarkdown beamer介绍:如何不打印部分幻灯片?

gfg*_*fgm 8 r beamer knitr r-markdown

我在rmarkdown写了一个beamer演示文稿并用knitr将它转换为pdf.我想在header1级别定义部分,例如# Introduction,然后有一个标题为其他的幻灯片,例如## Introducing my brilliant research.拥有header1级别定义部分是很好的,因为部分的名称可以在某些beamer主题的幻灯片标题中显示,这就是我包含它的原因.

但我不希望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)
```
Run Code Online (Sandbox Code Playgroud)

目前,此代码生成的幻灯片包括Markdown Intro,Using Bullets和Including Chunks.我希望这些幻灯片标记省略的部分.这可能吗?

Pau*_*eux 9

创建一个新的Latex模板,从前导码中删除此部分:

\AtBeginSection[]
{
  ....
}
Run Code Online (Sandbox Code Playgroud)

将此乳胶模板放在与.Rmd文件相同的文件夹中,并template: mytemplate.tex按照此处的说明 Rmd Yaml前端参考它.

  • 使用 header-includes: - \AtBeginSection{}` 修改 YAML 标头也是一个可行的选择。请参阅 /sf/ask/2672630901/ (4认同)
  • 辉煌.非常感谢.一个小小的变化:通过链接建议的模板文件似乎不包括投影仪.我在我的系统上找不到默认的beamer模板,所以我得到了[这里](https://github.com/jgm/pandoc-templates/blob/master/default.beamer)并按照你的建议进行编辑. (2认同)