r-bookdown数字格式:既有顺序编号,也有章节编号



使用bookdown(单个文档(时,如果同时设置了section_numbering = 'yes'fig_caption = 'yes',则数字编号为X.2(其中X是节号(。如果section_number = 'no',则图形按顺序编号(图1、2…(,但节号丢失。

有没有一种方法可以在不丢失章节编号的情况下按顺序编号数字?在下面的例子中,我希望两个部分的数字都编号为1和2。

谢谢。

---
output: 
bookdown::html_document2: 
fig_caption: yes
number_sections: yes
---
# header 1
Reference example: @ref(fig:plotcars):
```{r plotcars, fig.cap = "A car plot"}
plot(cars)
```
# header 2
Reference example: @ref(fig:plotcars2):
```{r plotcars2, fig.cap = "A car plot"}
plot(cars)
```

我刚刚在bookdown的开发版本中添加了一个新参数global_numbering。您可以通过测试开发版本

remotes::install_github('rstudio/bookdown')

示例:

---
output: 
bookdown::html_document2: 
fig_caption: true
number_sections: true
global_numbering: true
---
# header 1
Reference example: @ref(fig:plotcars):
```{r plotcars, fig.cap = "A car plot"}
plot(cars)
```
# header 2
Reference example: @ref(fig:plotcars2):
```{r plotcars2, fig.cap = "A car plot"}
plot(cars)
```

相关内容

最新更新