如何在R Markdown中设置表格全局连续编号而非按章节编号
解决Word文档中表格连续编号的问题
要让bookdown生成的Word文档里表格在全文连续编号(而非按章节编号),只需修改R Markdown的YAML输出配置,添加表格编号规则参数即可。
修改后的完整代码
--- title: Tables Query output: bookdown::word_document2: tables: numbering: continuous --- ```{r setup, include= FALSE} knitr::opts_chunk$set(echo = FALSE, warning = FALSE)
Section 1
Here is Table @ref(tab:foo)
knitr::kable(head(mtcars), caption = "a table")
Section 2
Here is another table Table @ref(tab:bar)
knitr::kable(head(iris), caption = "another table")
Section 3
Here is the third table Table @ref(tab:baz)
knitr::kable(head(mtcars), caption = "the third table")
## 说明 通过在`bookdown::word_document2`的配置中添加`tables: numbering: continuous`,表格编号会从1开始在全文连续递增,不再绑定章节层级。新增章节中的表格会自动延续编号序列,比如示例里的第三个表格会显示为*Table 3*。 内容的提问来源于stack exchange,提问作者Mark Davies
相关产品推荐
相关产品推荐

