bookdown图表编号格式:同时使用顺序编号和章节编号。

4
当使用bookdown(单个文档)时,如果我同时设置和,则图表编号为(其中为章节号)。如果,则图表按顺序编号(Fig 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)
```

我不是很确定,但这篇关于图标题格式的帖子可能会有用 https://dev59.com/OVQK5IYBdhLWcg3wZe9_。 - DaveArmstrong
1
抱歉,目前无法实现此功能。编号章节意味着图表与章节一起编号。如果您真的想要分离这两个编号系统,可以向Github存储库提交问题。谢谢! - Yihui Xie
感谢您的回复和出色的软件。我将提交一个问题。 - Hilaire Drouineau
1个回答

2

我刚刚添加了一个名为global_numbering的新参数到bookdown的开发版本中。您可以通过以下方式测试开发版本

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)
```

bookdown::pdf_book 输出中是否可用 global_numbering 参数? - Mark Davies
不,这不是。你需要找到一个LaTeX的解决方案来实现这个功能。 - Yihui Xie

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接