knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of rbbt is to connect R to the Better Bibtex for Zotero connector. This allows the insertion of in-text citations (pandoc or LaTex style) and BibLaTex bibliography items directly into the RStudio editor using the RStudio addin, or to the console otherwise.
You can install rbbt from GitHub with:
remotes::install_github("paleolimbot/rbbt")
library(rbbt)
You will also need Zotero installed and running, and the Better BibTeX for Zotero add-on installed.
This package is most useful for the RStudio addins that insert citations and references into the editor. The "Insert Zotero Citation" will pop up a zotero search where you can search for a reference to add to your writing (Markdown, RMarkdown, or LaTeX). The "Insert Zotero Bibliography" addin inserts the bibliographical information corresponding to the selected item in the Zotero window. Finally, "Update bibliography for current document" runs bbt_update_bib()
to update the bibliography based on the .Rmd file currently in the editor window. You can bind either of these to keyboard shortcuts in RStudio. The addins may behave differently depending on which file you have open (e.g., if you have a .bib file open, it will use the biblatex translator)...if you need more fine-grained control, try one of the console functions (like bbt_bib()
!).
To make this work seamlessly with knitr and rmarkdown, use the "Update bibliography for current document" addin to write your bibliography file based on the citations in the currently selected document. You can use bbt_update_bib("some_file.Rmd")
to detect citations and write your bibliography file from the console.
Fetch bibliography text using a list of Better BibTex citation keys:
# uses the citation keys you've defined with Better BibTeX rbbt::bbt_bib("dunnington_etal18", translator = "biblatex", .action = bbt_print)
Fetch bibliography text from selected items in Zotero:
# uses whatever is currently selected in the zotero window rbbt::bbt_bib_selected(translator = "biblatex", .action = bbt_print)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.