2017-02-24 51 views
7

我正在用rmarkdown写一个beamer演示文稿,并将其转换为pdf与knitr。我想在header1级别定义部分,例如# Introduction,然后有一张标题为其他内容的幻灯片## Introducing my brilliant research。使用header1级别定义节是很好的,因为节的名称可以在某些投影主题中的幻灯片标题中显示,这就是为什么我包含它。rmarkdown投影仪介绍:如何不打印部分幻灯片?

但我不想让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) 
``` 

目前,该代码产生的幻灯片说降价介绍,采用子弹,以及包括块。我希望那些标注省略部分的幻灯片。这可能吗?

+0

使用过的'slide_level:1'?这是解决你的问题吗? –

+0

不,这会使节标题成为幻灯片的标题,并将其后的所有幻灯片放到其下面的文本框中 – gfgm

+0

是否删除了标题1之后的空格而不是您想到的内容? –

回答

8

创建一个新的乳胶的模板,你从序言中删除此部分:

\AtBeginSection[] 
{ 
    .... 
} 

放置在同一文件夹中的文件.Rmd这乳胶的模板在RMD YAML和引用它前面的问题使用template: mytemplate.tex如解释here

+2

辉煌。非常感谢。一个小小的改变:通过你的链接建议的模板文件似乎不包括投影仪。我无法在系统上找到默认的Beamer模板,所以我在[这里](https://github.com/jgm/pandoc-templates/blob/master/default.beamer)找到了它并按照您的建议进行了编辑。 – gfgm