You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should be modified for each chapter individually so that only the R packages that are used in a given chapter are written to a bib file that is unique to each chapter. For example, chapter 9 that uses the leaflet and raster packages would have the following code block at the end of the chapter:
As well, we need to add a code block perhaps in chapter 1 (or a preface?) that provides the citations for knitr, bookdown, and other packages for the entire book:
I did some digging in the Knitr documentation and I wanted to make sure I understood the problem with issue #59 "write_bib() function needs to be reviewed and edited at the end of chapters". We need to dynamically update the package bibliographies and not the packages themselves? In this case, if we want the packages to be cited and displayed at the end of the chapter (and have each chapter be different) then I do believe that the proposed solution of having packages-ch1.bib, packages-ch2.bib, etc. is the way to go. If the bibliographies will all be shown at the end of the book, then there will only need to be one packages.bib file containing all of the information. The documentation here https://www.rdocumentation.org/packages/knitr/versions/1.29/topics/write_bib shows an example of a package file being written to that is only for a project's GUI packages, which I feel like supports the idea of multiple .bib files within one project.
According to this section at https://bookdown.org/yihui/rmarkdown-cookbook/write-bib.html, the write_bib() function is indeed meant to rewrite the file it is accessing, so that is why the packages are being rewritten upon each render. To fix this, I believe there should be only one write_bib() function in the book, which would live in the "Packages Index" chapter (or something similarly named). That way, each of the packages would be updated at the beginning of rendering the "Packages Index" chapter, which would then mean that the references within the chapter would be correct.
There was a code block that was originally distributed in the chapter template rmd file that looks like below:
This should be modified for each chapter individually so that only the R packages that are used in a given chapter are written to a bib file that is unique to each chapter. For example, chapter 9 that uses the
leaflet
andraster
packages would have the following code block at the end of the chapter:As well, we need to add a code block perhaps in chapter 1 (or a preface?) that provides the citations for
knitr
,bookdown
, and other packages for the entire book:Then, these .bib files can be linked together following the bookdown documentation:
The text was updated successfully, but these errors were encountered: