【发布时间】:2021-01-14 18:08:52
【问题描述】:
我正在使用新的 bookdown::bs4_book() 输出创建一个 {bookdown} 项目。但是,当我尝试使用{.tabset} 将标签添加到章节时,如here 所述,不会生成标签。相反,文档以正常的线性布局呈现。
{.tabset} 可以和bookdown::bs4_book() 一起使用吗?
我在this GitHub repo 中做了一个最小的bs4_book() 项目,渲染的输出托管在这里:https://bs4-reprex.netlify.app/intro.html
这是链接章节的原始 R Markdown 代码(也可在 repo here 中找到)。
# Introduction {#intro}
You can label chapter and section titles using `{#label}` after them, e.g., we can reference Chapter \@ref(intro).
If you do not manually label them, there will be automatic labels anyway, e.g., Chapter \@ref(methods).
## Figures and Tables {.tabset}
### Figures
Figures and tables with captions will be placed in `figure` and `table` environments, respectively.
```{r nice-fig, fig.cap='Here is a nice figure!', out.width='80%', fig.asp=.75, fig.align='center'}
par(mar = c(4, 4, .1, .1))
plot(pressure, type = 'b', pch = 19)
```
### Tables
Reference a figure by its code chunk label with the `fig:` prefix, e.g., see Figure \@ref(fig:nice-fig).
Similarly, you can reference tables generated from `knitr::kable()`, e.g., see Table \@ref(tab:nice-tab).
```{r nice-tab, tidy=FALSE}
knitr::kable(
head(iris, 20), caption = 'Here is a nice table!',
booktabs = TRUE
)
```
## {.unnumbered}
You can write citations, too.
For example, we are using the **bookdown** package [@R-bookdown] in this sample book, which was built on top of R Markdown and **knitr** [@xie2015].
【问题讨论】:
标签: r r-markdown bookdown