컨텐츠로 건너뛰기

Quarto Reference Manager: Simple citation management with CiteDrive for RStudio

이 내용은 아직 번역본이 없습니다.

Are you looking for a simple and efficient way to manage your citations in your quarto documents? CiteDrive for RStudio is an excellent solution. Not only does it simplify the management of your bibliography, but it also allows you to insert references into your documents easily. Let’s take a look at the first steps together. In the first part, you will learn how to connect your CiteDrive project to Quarot and select bibliographic options, citation syntax, and bibliography styles.

What is Quarto and CiteDrive?

The growing popularity of interactive and explorable content has revolutionized scholarly publishing. With the introduction of R Markdown, RStudio created an innovative way to combine R code with Markdown. Now, with Quarto, a new implementation of R Markdown, researchers and authors have an even more powerful platform for presenting their analyses and results.

Quarto is an open-source scientific and technical publishing platform that allows authors to use Jupyter Notes or plain Markdown text in their favorite editor. It enables dynamic content creation using Python, R, Julia, and Observable. With Quarto, you can publish articles, presentations, dashboards, websites, blogs, and books in multiple formats. Integration with Posit Connect, Confluence, and other publishing systems makes it easy to share knowledge and insights. With Pandoc Markdown, authors can create equations, citations, cross-references, figures, annotations, and more.

CiteDrive is a free and easy-to-use online literature management tool designed specifically for integration with Quarto. It uses the BibTeX format, the standard format for bibliographic databases in LaTeX and other LaTeX editors, as well as Markdown editors such as RStudio (R Markdown/Quarto), Zettlr, Obsidian.md, VS Code, Atom, and Typora. The bibliography database is project-based and allows you to organize literature for specific projects such as essays, papers, books, etc. CiteDrive also offers Chrome, Edge, and Firefox browser extensions that allow you to save articles, websites, or blog posts directly as BibTeX bookmarks.

Getting Started

Step 1 Setting up a project

After registering with CiteDrive, you can begin your first project. CiteDrive allows you to manage multiple projects, helping you and your co-authors stay organized and focused on your upcoming publication, book, or dissertation.

Step 2 Adding references

Add citations to your new project. You can add citations online using our built-in journal search engine, BibTeX entries, or BibTeX files. You can also add citations using the CiteDrive Companion browser extension, available for Chrome, Edge, and Firefox. When you are finished, your project should look like this.

CiteDrive Dashboard

To link your CiteDrive project to a Quarto project, simply click on the .bib button in the top right corner of your CiteDrive project page.

A dialog box will open in which you can either copy the link to bibsync or download it or you can download the BibTeX file.

Click Copy and paste the URL from the new tab into the YAML section of your QMD file. Right after “bibliography:“.

---
bibliography: 'https://api.citedrive.com/bib/[...]references.bib?x=[...]'
---

This link contains all your bibliographies for your QMD document. Every time you make changes or add new references, Quarto will automatically update the bibliographic information, i.e. your CiteDrive project is now synchronized with Quarto.

Step 4 Copying citations

First, make sure that the “Quarto” citation mode is selected. You can change the mode in the settings; click on your avatar in the top right corner of the navigation bar to get there.

Now select the elements (click on the white circle of the reference) that you want to “cite” in your quarto document and click on the “Cite” button (see following animation) to copy them.

Then insert the information, i.e. the citation key, at the desired location in your Quarto document.

Click on “Render” in RStudio and you will see that the citations and the bibliography are rendered in the correct format.

You can also select several citations at the same time. CiteDrive automatically formats the citations in the “multiple citations” format, e.g. [@citation_key1; @citation_key2].

Advance usage

Citation Syntax

As you saw in the last step of our introduction, Quarto uses the standard Pandoc markdown representation for citations. Each citation must have a key consisting of ’@’ + the citation identifier, the citationkey, from the BibTeX entry, and can optionally have a prefix, a locator, and a suffix. Citations are enclosed in square brackets and separated by semicolons if several are cited simultaneously in the same context.

Here are some examples of how citations can be displayed correctly in Pandoc Markdown, based on the information provided:

Basic citations

A simple citation in square brackets:

[@citation_key]

Multiple citations

Multiple citations are separated by semicolons:

[@citation_key1; @citation_key2]

Citations with prefixes and suffix

You can add a prefix and/or suffix to a citation to provide additional information:

[see @citation_key, pp. 23]
[@citation_key1, ch. 2; see also @citation_key2, pp. 45-47]

Citations with a ‘locator’

As already indicated here in the suffix, we use locators. A locator (e.g. chapter, page) can be used to reference specific parts of the source:

[@citation_key, pp. 45-55]
[@citation_key, chap. 3]

In the background, Quarto recognizes many predefined locators, depending on the language setting ‘locale,’ to interpret it correctly based on the citation style specification. If no style has been defined, Chicago style (https://cmosshoptalk.com/2017/05/17/what-is-author-date-style/) is automatically used, and [@citation_key, p. 45] becomes (Smith 2020, 45). Note that the Chicago style automatically omits the locator, as is the default.

However, if we use apa.csl, the `[@citation_key, p. 45]“ becomes (Smith, 2020, p. 45).

We distinguish between a singular form and a plural form. The page or page range (from page x to page y) is specified in the example of Pages. Here is an example:

[@citation_key, pp. 45-55] becomes (Smith, 2020, pp.45-55)

Here is a complete list of predefined locators, both in singular form and in plural form, that work in English:

Locator TermSingular FormPlural Form
Bookbook, bk.bks.
Chapterchapter, chap.chaps.
Columncolumn, col.cols.
Figurefigure, fig.figs.
Foliofolio, fol.fols.
Numbernumber, no.nos.
Lineline, l.ll.
Notenote, n.nn.
Opusopus, op.opp.
Pagepage, p.pp.
Paragraphparagraph, para.paras.
Partpart, pt.pts.
Sectionsection, sec.secs.
Sub verbos.v.s.vv.
Verseverse, v.vv.
Volumevolume, vol.vols.
Paragraph Symbol¶¶
Section Symbol§§§

If no locator term is used, “page” is assumed. Also, if you want to customize or omit the locator, you can “force” this by enclosing the locator in curly brackets. [@smith{}, some suffix] will omit the locator, or [@smith{custom locator}, some suffix].

Finally, a combined quotation Combination of prefix, locator and suffix in a citation:

[see @citation_key, p. 23-25; see also @other_key, section 4.2]

Citations in footnotes

To create footnotes in Quarto using Markdown, you can use the following syntax

This is a sample text with a footnote[^1].

Place the caret symbol (^) and a footnote number or name in square brackets where you want the footnote to appear. Then define the footnote at the end of the document or section. Quarto will render this correctly in the desired output format.

Citation and Bibliography Styles

To define the citation style in Quarto, you have to specify the citation style in the YAML frontend of your document. Here is a small example:

---
title: "Your document title
author: "Your name
bibliography: references.bib # path to your bibliography file
csl: your-style.csl # path or url to your CSL style file
---

Replace references.bib with the path to your bibliography file and your-style.csl with the path to your Citation Style Language (CSL) file. This setting applies the specified citation style to your Quarto document. You can find all citation styles in the official Citation Style Language github repo, where you can download them: https://github.com/citation-style-language/styles

You can also click on the file in GitHub and then click on raw. There you will see the XMl stylesheet. You can copy it and define it in your YAML:

---
...
csl: https://raw.githubusercontent.com/citation-style-language/styles/master/[...any style].csl
...
---

If you do not set a path or url to a citation style, the Chichago author date style will be used automatically.

Also note that if you use a citation method other than citeproc, the styles will not work. See the last section of this guide.

Reference list

Quarto automatically places the reference list at the end of the document. However, if you want the list to appear at a specific location, you can do so by using {#refs} within the document.

### My bibliography
::: {#refs}
:::

Quarto will only display references that have been cited in your document using the [@citationkey] command.

To include references that aren’t cited in your document, you need to add a nocite field to your yaml. Here is an example:

---
title: "...."
bibliography: "api.citedrive[...]" # or references.bib
nocite: |
@einstein, @knuth
---

To add all of the references from your bib file, use @*:

---
nocite: |
@*
---

More resources

https://pandoc.org/chunkedhtml-demo/8.20-citation-syntax.html

https://quarto.org/docs/authoring/footnotes-and-citations.html