Written and maintained by CASRAI Editorial Board
Last updated
Quarto, R Markdown, and plain Pandoc all format citations the same way under the hood — a bibliography YAML field points at a reference file, [@key] markers in the text mark where a citation goes, and Pandoc’s built-in citeproc engine does the actual formatting into your chosen citation style. The three tools differ in how a document gets rendered (knitr or Jupyter for Quarto, knitr for R Markdown, nothing extra for plain Pandoc), but not in how citations are declared or processed — the same YAML fields and the same [@key] syntax work in all three, because R Markdown and Quarto both compile through Pandoc rather than implementing their own citation logic. This guide covers the shared mechanics, where the three tools actually diverge, and the mistakes that most often break a bibliography.
One citation engine, three front ends
Pandoc’s citation processor — citeproc — reads citation keys in the body text, looks each one up in a bibliography file, and replaces the key with a formatted in-text citation while building a reference list at the end of the document. R Markdown (via the rmarkdown package) and Quarto both compile a document by handing it to Pandoc as one step in their render pipeline, and citeproc runs as part of that Pandoc step. Per Pandoc’s own manual, --citeproc is the flag that turns this on for a raw Pandoc invocation, but Quarto and R Markdown enable it automatically the moment a document’s YAML front matter includes a bibliography field — there is nothing extra to install for basic citation support in either.
What this means practically: a .bib file, a bibliography: field, and [@key] citations behave identically whether the file extension is .qmd (Quarto), .Rmd (R Markdown), or a plain .md file being run through the pandoc command line directly. Once you understand one, you understand all three.
The bibliography field
Add a bibliography by naming a file in the YAML header:
--- title: "My Paper" bibliography: references.bib ---
Pandoc accepts several bibliography formats for this field — BibTeX (.bib), BibLaTeX (.bibtex), CSL JSON, and RIS are all valid, and the format is inferred from the file extension. Multiple files can be combined by giving the field a YAML list:
bibliography: - references.bib - extra-sources.json
See CASRAI’s BibTeX file format guide and RIS file format guide for the structure of the two most common formats, and the DOI-to-BibTeX guide for generating individual entries from a DOI without hand-typing them.
Writing in-text citations
Citations use an @-prefixed key inside square brackets, matching a key in the bibliography file:
Blah blah [@smith04]. Blah blah [see @smith04, pp. 33-35 and *passim*]. Blah blah [@smith04; @doe99]. @smith04 says blah. Blah blah [-@smith04].
The bracketed form places the whole citation parenthetically; dropping the brackets (@smith04 says blah) produces a narrative citation with only the year in parentheses; a leading hyphen ([-@smith04]) suppresses the author name entirely, useful when the author was already named in the surrounding sentence. Per Pandoc’s manual, citation keys must start with a letter, digit, or underscore and may contain a defined set of punctuation characters, which is why citation-key generators (see CASRAI’s Better BibTeX for Zotero guide) avoid spaces and most special characters by default.
Setting the citation style
Without a style specified, Pandoc’s citeproc defaults to Chicago author-date. To use a different style, add a csl field pointing at a Citation Style Language (.csl) file:
--- bibliography: references.bib csl: apa.csl ---
CSL files for thousands of journals and citation styles are maintained in the open Zotero Style Repository, and the CSL project’s own “Search by Example” tool can match an unfamiliar target journal’s sample reference against a known style name. See CASRAI’s guide to citation styles and referencing formats for how CSL relates to the older named styles (APA, MLA, Chicago, Vancouver) researchers already know, and LaTeX bibliography styles explained if the same document also needs to compile through a .bst-based LaTeX pipeline rather than citeproc.
Where R Markdown and Quarto actually diverge
The citation YAML fields and [@key] syntax are identical between the two, but the surrounding render pipeline differs in ways worth knowing before troubleshooting a citation that “should” work:
- Execution engine. R Markdown always runs through
knitr. Quarto can run throughknitr(for R code chunks) or Jupyter (for Python/Julia/Observable), set via theenginefield or inferred from chunk languages present — either way, citation processing itself still happens in the shared Pandoc step after code execution, not inside the engine. - Cross-references. Quarto adds its own cross-referencing system (
@fig-,@tbl-,@eq-prefixed labels) for figures, tables, and equations, which uses the same@-prefix visual convention as citations but is a distinct Quarto-specific mechanism, not part of citeproc — don’t confuse a broken figure cross-reference with a broken bibliography citation when debugging. - Multi-format output. Quarto’s single-source-multiple-format model (one
.qmdrendering to HTML, PDF, and Word from the same source) means a citation style choice made once in the YAML header applies consistently across every output format, whereas an older R Markdown project juggling separate PDF and Word templates sometimes carried format-specific citation settings.
Keeping the bibliography file current
A .bib file maintained by hand drifts out of date as a paper’s source list grows. If the library lives in Zotero, the practical fix is Better BibTeX’s Auto-Export feature — a live-updating .bib/CSL-JSON export tied to a Zotero collection that regenerates automatically as references are added, without a manual re-export before every render. See CASRAI’s Better BibTeX for Zotero guide for setup, and adding citations and a bibliography in Overleaf for the equivalent workflow on a LaTeX-first pipeline rather than Quarto/R Markdown.
Common problems and fixes
- A citation renders as a literal
[@key]or a “?” mark instead of formatted text. The key in the text doesn’t match any key in the bibliography file exactly — check for a typo, a case mismatch, or a key that Better BibTeX regenerated after the in-text citation was already written. - No reference list appears at all. Citeproc only runs when a
bibliographyfield is present in the YAML header; a document with[@key]citations but nobibliography:field will render the raw bracket text with no processing and no error. - The style doesn’t match what was expected. Confirm the
cslfield points at the intended file and that the file itself is a valid CSL style (an incorrect or corrupted.cslfile silently falls back to citeproc’s default Chicago author-date rather than raising a visible error in most setups). - PDF output needs a LaTeX-native bibliography instead of citeproc. Setting
cite-method: natbiborcite-method: biblatexswitches PDF rendering to LaTeX’s own citation packages instead of citeproc — useful when a journal’s LaTeX template assumesnatbib/biblatexcommands directly, but it changes which citation styles and.bibquirks apply, since the two engines don’t handle malformed BibTeX identically.
Frequently asked questions
Can I cite a source without it appearing in the text?
Yes — the YAML field nocite forces one or more bibliography entries into the reference list without an in-text citation marker. nocite: '@*' includes the entire bibliography file, which is occasionally used for a “further reading” list distinct from works actually cited.
Do I need to install anything extra for citations to work in Quarto or R Markdown?
No — citeproc ships as part of Pandoc, and both Quarto and the rmarkdown package bundle their own Pandoc installation, so adding a bibliography field is enough to activate citation processing with no separate package install.
Can I use the same bibliography file across Quarto, R Markdown, and a LaTeX project?
Yes, provided it’s in a format all three can read — a standard .bib file is the most portable choice, since it works directly in LaTeX/BibTeX and is one of the formats citeproc accepts natively for Quarto and R Markdown.
For the tool decisions upstream of this — which reference manager to build the .bib file from in the first place — see CASRAI’s Research Tools hub and the Zotero vs. JabRef comparison for the two reference managers most commonly paired with a LaTeX/Pandoc-based writing workflow.








