Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
528 views
in Technique[技术] by (71.8m points)

r - RMarkdown: How to end tabbed content

Once I have defined tabs, how do I define content outside/below tabs? Or, how do I end tabbed content?

I have planned a layout like so:

title
content above tabbed region.

tab1 tab2
-------------------
tab content 1
-------------------
content below tabbed region

which in rmarkdown would be

## title {.tabset .tabset-fade}
content above tabbed region.

### tab 1 
tab content 1
### tab 2
tab content 2

content below tabbed region.

But, content below tabbed region. appears as part of tab2. How can it be defined outside of the tab?

Perhaps I might have further headings in content below. So a related question would be how can I define which headings to be part of tab and which ones not to be?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

My approach to this problem is simple, but it works:

## title {.tabset .tabset-fade}
content above tabbed region.

### tab 1 

tab content 1

### tab 2

tab content 2

##

content below tabbed region

The tab works only for 'sub-headers of the header with the.tabset attribute to appear within tabs rather than as standalone section' (see here)

So you just have to define a new header (in this case no title) one level above the tabs to signalize RMD not to be in a tabbed section.

enter image description here

It is also possible to design a document with different tabs in different headers:

## section 1 {.tabset .tabset-fade}
content above tabbed region.

### tab 1 

tab content 1

### tab 2

tab content 2

## section 2 {.tabset .tabset-fade}

### tab 1 

tab content 1

### tab 2

tab content 2

### tab 3

tab content 3

#
content below tabbed region

enter image description here

Edit: If you want to use a Table of Content (TOC) there is a problem with the solution above, because the last # will create an empty entry in the TOC. The solution here is to use

## {.unlisted .unnumbered}

content below tabbed region

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...