Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am preparing an historical book manuscript, written in R-Markdown with Bookdown, which will have 8 chapters, each with 100+ Chicago-style endnotes, using the GitBook-style web format.

My goal is to restart endnote numbering after each chapter, to avoid running into high digits and to resemble the appearance of traditional history books.

I have experimented with most of the settings described here (https://bookdown.org/yihui/bookdown/html.html#gitbook-style), but cannot produce the desired web output. Here's the relevant portion of my index.Rmd:

output:
  bookdown::gitbook:
    dev: svglite
    css: css/style.css
    split_by: rmd
    split_bib: true

See my simplified mockup demo: https://jackdougherty.github.io/bookdown-test/book/ and source code: https://github.com/JackDougherty/bookdown-test

like image 842
jackdougherty Avatar asked May 31 '18 04:05

jackdougherty


1 Answers

Note that in bookdown v 0.9, the <a> tag's class inside the citation changed from .footnote-ref to .footnoteRef. So you need to extend some of your CSS to account for that when using an updated version of 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;
}

...

See https://github.com/rstudio/bookdown/issues/589#issuecomment-462149512 for more details.

like image 173
ilyankou Avatar answered Sep 26 '22 01:09

ilyankou