【问题标题】:bookdown figure number formattiing: both sequential numbering and section numberingbookdown数字格式:顺序编号和部分编号
【发布时间】:2020-09-11 14:56:23
【问题描述】:

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

【问题讨论】:

标签: r r-markdown bookdown


【解决方案1】:

I just added 一个新参数 global_numberingbookdown 的开发版本。您可以通过

测试开发版本
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)
```

【讨论】:

  • global_numbering 参数是否可用于bookdown::pdf_book 输出?
  • 不,不是。您需要为该功能找到 LaTeX 解决方案。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多