Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paleolimbot/rbbt
R Interface to the Better BiBTex Zotero Connector
https://github.com/paleolimbot/rbbt
Last synced: 3 months ago
JSON representation
R Interface to the Better BiBTex Zotero Connector
- Host: GitHub
- URL: https://github.com/paleolimbot/rbbt
- Owner: paleolimbot
- Created: 2018-10-09T21:38:53.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-29T04:24:01.000Z (6 months ago)
- Last Synced: 2024-06-12T18:32:04.969Z (5 months ago)
- Language: R
- Size: 94.7 KB
- Stars: 141
- Watchers: 11
- Forks: 25
- Open Issues: 13
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output: github_document
bibliography: README.bib
csl: CJFAS.csl
---```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# rbbt
[![R build status](https://github.com/paleolimbot/rbbt/workflows/R-CMD-check/badge.svg)](https://github.com/paleolimbot/rbbt/actions)
The goal of rbbt is to connect R to the [Better Bibtex for Zotero connector](https://retorque.re/zotero-better-bibtex/). 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.
## Installation
You can install rbbt from GitHub with:
``` r
remotes::install_github("paleolimbot/rbbt")
``````{r}
library(rbbt)
```You will also need [Zotero](https://www.zotero.org/) installed and running, and the [Better BibTeX for Zotero](https://retorque.re/zotero-better-bibtex/installation/) add-on installed.
## RStudio Addin
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()`!).
## knitr + rmarkdown integration
To make this work seamlessly with [knitr](https://yihui.org/knitr/) and [rmarkdown](https://rmarkdown.rstudio.com/), 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.
## Programmatically fetch bibliography info
Fetch bibliography text using a list of Better BibTex citation keys:
```{r, comment=""}
# 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:
```{r, comment=""}
# uses whatever is currently selected in the zotero window
rbbt::bbt_bib_selected(translator = "biblatex", .action = bbt_print)
```