RMarkdown:如何结束标签内容 [英] RMarkdown: How to end tabbed content

查看:28
本文介绍了RMarkdown:如何结束标签内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦我定义了标签,我该如何定义标签外/下的内容?或者,我如何结束标签内容?

我已经计划了这样的布局:

title标签区域上方的内容.选项卡 1 选项卡 2-------------------标签内容 1-------------------标签区域下方的内容

在 rmarkdown 中将是

## title {.tabset .tabset-fade}标签区域上方的内容.### 选项卡 1标签内容 1### 选项卡 2标签内容 2标签区域下方的内容.

但是,标签区域下方的内容. 显示为 tab2 的一部分.如何在选项卡外定义?

也许我在下面的内容中有更多的标题.所以一个相关的问题是我如何定义哪些标题是标签的一部分,哪些不是?

解决方案

我解决这个问题的方法很简单,但很管用:

## title {.tabset .tabset-fade}标签区域上方的内容.### 选项卡 1标签内容 1### 选项卡 2标签内容 2##标签区域下方的内容

该选项卡仅适用于带有 .tabset 的标题的子标题属性出现在选项卡中而不是作为独立部分'(请参阅

还可以在不同的标题中设计具有不同选项卡的文档:

## section 1 {.tabset .tabset-fade}标签区域上方的内容.### 选项卡 1标签内容 1### 选项卡 2标签内容 2## 第 2 节 {.tabset .tabset-fade}### 选项卡 1标签内容 1### 选项卡 2标签内容 2### 选项卡 3标签内容 3#标签区域下方的内容

编辑:如果你想使用目录(TOC),上面的解决方案有问题,因为最后一个# 将在 TOC 中创建一个空条目.这里的解决方案是使用

## {.unlisted .unnumbered}标签区域下方的内容

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?

解决方案

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.

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

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

这篇关于RMarkdown:如何结束标签内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆