Search code examples
rknitrr-markdowncitationscsl

How do I cite papers with multiple authors using YAML metadata with RMarkdown + knitr?


I'm writing my package's vignette and I'm trying include a paper containing multiple authors as reference, using something like this in the beginning of the code:

---
references:
- id: doe2009
  title: A Method for Something
  author:
  - family: Doe
    given: John
  - family: Shepard
    given: Jane
  container-title: Some Journal
  volume: 11
  issue: 45
  page: 33-39
  type: article-journal
  issued:
    year: 2009
---

Problem is, my citation goes on the end like this:

Doe, John, and Jane Shepard. 2009. “A Method for Something.” Some Journal 11 (45): 33–39.

There is one pattern for the first author and another for the second author.

How can I change this to a more consistent form? Also, I'm trying to avoid external files to my package... is there a way for doing this without using an external csl?

I'm sorry that the problem may sound trivial. I don't know nothing about CSL and this is my first attempt to publish a package.


Solution

  • Sorry, but I don't think this can be done without an external file.

    The RStudio help page on bibliographies says

    By default, pandoc will use a Chicago author-date format for citations and references. To use another style, you will need to specify a CSL 1.0 style file in the csl metadata field.

    Going to the Zotero style repository page for Chicago format (and mousing over the first style entry) shows that the Chicago style does indeed set the last author name as "Firstname Lastname" (all others as "Lastname, Firstname").

    Going haphazardly to a different style, e.g. the APA style, can give you a style with consistent author formats independent of order (click to download one of the CSL files).