简体   繁体   中英

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. 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. But I would like to start with Header 2 and not repeat header 1 again. 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 :

---
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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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