在 R Bookdown 中每个 GitBook 风格的网页章节后重新开始尾注编号

restart endnote numbering after each GitBook-style web chapter in R Bookdown

我正在准备一本历史书籍手稿,用 R-Markdown 和 Bookdown 编写,将有 8 章,每章有 100 多个芝加哥风格的尾注,使用 GitBook 风格的网络格式。

我的目标是在每章后重新开始尾注编号,以避免 运行 变成高位数字并类似于传统历史书籍的外观。

我已经尝试了此处描述的大部分设置 (https://bookdown.org/yihui/bookdown/html.html#gitbook-style),但无法生成所需的 Web 输出。这是我的 index.Rmd:

的相关部分
output:
  bookdown::gitbook:
    dev: svglite
    css: css/style.css
    split_by: rmd
    split_bib: true

查看我的简化模型演示: https://jackdougherty.github.io/bookdown-test/book/ 和源代码: https://github.com/JackDougherty/bookdown-test

请注意,在 bookdown v 0.9 中,引文中 <a> 标签的 class 已从 .footnote-ref.footnoteRef。 因此,您需要扩展一些 CSS 以在使用更新版本的 bookdown 时考虑到这一点:

/* don't show the wrong footnote calls */
.footnote-ref sup,
.footnoteRef sup {
  display: none;
}

...

.footnote-ref,
.footnoteRef {
  counter-increment: fn-call;
}

.footnote-ref::after,
.footnoteRef::after {
  content: counter(fn-call);
  position: relative;
  top: -.5em;
  font-size: 85%;
  line-height: 0;
  vertical-align: baseline;
}

...

有关详细信息,请参阅 https://github.com/rstudio/bookdown/issues/589#issuecomment-462149512