简体   繁体   English

是否可以在R Markdown文件中将标题定义为标题?

[英]Is it possible to define the title in an R Markdown file as a header?

I want to use tabs in my markdown document. 我想在我的降价文档中使用标签。 I can apply the .tabset class attribute to my header, that's no issue. 我可以将.tabset class属性应用于标题,这没有问题。 However, I would like to apply it to my title. 但是,我想将其应用于我的标题。 Let's say I have the following code: 假设我有以下代码:

---
title: 'Header 1'
author: "Homer Simpson"
date: "4/26/2017"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Header 1 {.tabset}

## Header 2

So header 1 appears twice. 因此标题1出现两次。 But I would like to start with Header 2 and not repeat header 1 again. 但是我想从标题2开始,而不是再重复标题1。 How How would I do that? 我该怎么做? Thank you! 谢谢!

Avoiding to give a name to the tabset solves you issue: 避免给选项卡命名,可以解决以下问题:

---
title: 'Header 1'
author: "Homer Simpson"
date: "4/26/2017"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# {.tabset}

## Header 2

## Header 3

Or similarly avoiding the document title : 或者类似地避免使用文档title

---
author: "Homer Simpson"
date: "4/26/2017"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Header 1 {.tabset}

## Header 2

## Header 3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM