library(knitr)
Distill articles support including citations and a corresponding bibliography using standard R Markdown citation syntax. Distill also provides tools for making your articles more easily citeable, as well as for generating [Google Scholar] compatible citation metadata.
Use standard R Markdown bibliographies for citing other works. To do this, first create a bibliography file using a supported format (e.g. CSL or BibTeX) and refer to it from the bibliography
field of the YAML front-matter. For example:
--- title: "Distill for R Markdown" description: | Scientific and technical writing, native to the web output: distill::distill_article date: May 4, 2018 author: - name: Nora Jones url: https://example.com/norajones affiliation: Spacely Sprockets affiliation_url: https://example.com/spacelysprokets bibliography: biblio.yaml ---
Here's an example of what a CSL bibliography might look like:
--- references: - type: article-journal id: WatsonCrick1953 author: - family: Watson given: J. D. - family: Crick given: F. H. C. issued: date-parts: - - 1953 - 4 - 25 title: 'Molecular structure of nucleic acids: a structure for deoxyribose nucleic acid' title-short: Molecular structure of nucleic acids container-title: Nature volume: 171 issue: 4356 page: 737-738 DOI: 10.1038/171737a0 URL: https://www.nature.com/articles/171737a0 language: en-GB ...
To cite this within your article, use standard R Markdown notation, for example: [@WatsonCrick1953]
(referencing an id provided in the bibliography). See the documentation on Pandoc Citations for details on in-text citations, citing multiple works, etc.
Note that both CSL and BibTeX bibliographies are supported. See the Pandoc Bibliographies documentation for addional details on creating a bibliography for use with Pandoc.
You can make it easier for others to cite your work by providing additional metadata with the YAML front-matter of your article. Citations can be provided for both articles published to the web or for articles published in journals (with or without a DOI).
To provide a citation for an article published to the web, include author
and date
metadata as well as a citation_url
. For example:
--- title: "Distill for R Markdown" description: | Scientific and technical writing, native to the web date: May 4, 2018 author: - name: Nora Jones url: https://example.com/norajones affiliation: Spacely Sprockets affiliation_url: https://example.com/spacelysprokets citation_url: https://rstudio.github.io/distill slug: jones2018distill bibliography: biblio.bib ---
Note that the citation_url
field is not required for blog articles (in that case it's computed automatically using the site's base_url
field).
When this metadata is available, a citation appendix is automatically added to the article which looks like this:
{.screenshot width="95%"}
Note that we also included a slug
field (in this case jones2018distill
) which affects the abbreviated version of the citation included in the BibTeX entry. If you don't provide a slug
then one will be automatically generated.
If your article is published within a Journal, you can add the following the additional fields to generate the appropriate citation entry:
| Metadata | Description |
|-----------|---------------------------------------------------------|
| journal
| Name of Journal published within |
| doi
| Digital Object Identifier (DOI) |
Here's our previous examples amended with these fields:
--- title: "Distill for R Markdown" description: | Scientific and technical writing, native to the web date: May 4, 2018 author: - name: Nora Jones url: https://example.com/norajones affiliation: Spacely Sprockets affiliation_url: https://example.com/spacelysprokets journal: "Journal of Data Science Software" doi: "10.23915/distill.00010" slug: jones2018distill citation_url: https://rstudio.github.io/distill bibliography: biblio.bib ---
This is how the citation is presented in the appendix:
{.screenshot width="95%"}
For Journal articles, the citation_url
is included in the BibTeX entry within the note
field.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.