Search code examples
rms-wordr-markdownbibliography

Include extra bibliography in R Markdown


I am writing my dissertation using R Markdown (output: Word) and have my primary bibliography from which all citations are based. This renders with no issue:

yaml:

---
site: bookdown::bookdown_site
documentclass: book
output:
  officedown::rdocx_document:
     base_format: "bookdown::word_document2"
     reference_docx: template.docx
     pandoc_args: [ "--csl", "apa.csl"]
bibliography: references.bib
biblio-style: apalike
link-citations: yes
---

However, in my appendix, I'd also like to include a separate list of references to cite all the packages I used, packcages.bib. I cannot seem to find an easy way of adding an additional bibliography. I tried following this answer but it produced too many encoding errors. I thought of just rendering a separate Word file and attaching/inserting it into the appendix, but did not find a function that could do this.

Any suggestions?


Solution

  • The contents of an external Word file can be included in R Markdown via officer::block_pour_docx. I used Zotero to generate a Word bibliography based on pacakges.bib and then the following to include in my document:

    ```{r}
    block_pour_docx("packages.docx")
    ```