A workflow to integrate Zotero to markdown in R Studio to enable automated reference citing in markdown files.
This project is maintained by shanptom
I started using Markdown as a note-taking tool mainly because it let me combine text and code in one place, without needing to switch between different applications. Eventually, I moved on to Quarto Markdown for a cleaner UI. It allowed me to write explanatory notes right next to the code, keeping everything clean and readable without the need for cluttered #comments.
One of the things I like most about Markdown is its flexibility—it supports reproducible research. I can share both the code and results in different formats like HTML, PDF, or Word. For easier sharing, I often save HTML files as MHTML, so I have a single self-contained file with scripts and results in interactive visualizations. This makes collaboration much smoother. On top of that, RStudio’s built-in Git GUI makes version control and backups easy, which helps maintain the integrity of my projects.
For reference management, I rely on Zotero. It’s a solid open-source tool that avoids the restrictions of proprietary alternatives and handles citations well. With plugins like Better BibTeX, it integrates nicely with RStudio, making bibliography management in academic writing much more efficient.
In this post, I’ll go through how to write articles/manuscripts in RStudio using Markdown and manage references with Zotero, all within a workflow that’s clean, efficient, and reproducible.
.mhtml
files.Download Plugin: Better BibTeX v7.0.26 Release
Install in Zotero:
Tools → Plugins → ⚙️ Gear Icon → Install Add-on From File
.xpi
fileOpen Settings:
Edit → Preferences → Better BibTeX
Set Citation Key Formula:
[auth.etal:lower:replace=.,_:postfix=_][>0][year]|[veryshorttitle][year]
rbbt
R Package# Install rbbt from GitHub
if (!require("remotes")) install.packages("remotes")
remotes::install_github("paleolimbot/rbbt")
Tools → Modify Keyboard Shortcuts...
"Zotero"
Ctrl + L
or Cmd + L
)title: "Article Title"
author: "Author Name"
date: "`r Sys.Date()`"
output:
html_document:
code_folding: hide
code_download: false
knitr:
echo: false
warning: false
message: false
fig.width: 15
fig.height: 6
editor: visual
bibliography: "`r rbbt::bbt_write_bib('bibliography.json', overwrite = TRUE)`"
Ctrl+L
)Let RStudio handle:
.json
citation fileFirst citation:
bibliography.json
Later citations:
Final output:
Inspired by community contributions from:
Dunnington, Dewey. 2020. “Getting Started with Zotero, Better BibTeX, and RMarkdown.” May 9, 2020. https://dewey.dunnington.ca/post/2020/getting-started-zotero-better-bibtex-rmarkdown/.
Rioja, Kenneth. (2023) 2025. “Kennethrioja/Rmdzoteroword_workflow.” Shell. https://github.com/kennethrioja/rmdzoteroword_workflow.
Verhoeven, Gertjan. 2021. “Writing Scientific Papers Using Rstudio and Zotero.” Gertjan Verhoeven. May 2, 2021. https://gsverhoeven.github.io/post/zotero-rmarkdown-csl/.