Citing multiple publications by same author in same year in RMarkdown
Asked Answered
B

1

8

I have two citations by the same author, and they were published in the same year.

Right now, my code looks like this

blah blah Hansen [-@Hansen2015a; -@Hansen2015b]

and I get this

blah blah Author (2015; 2015) blah blah

I want the result to look like this

blah blah Author (2015a, 2015b) blah blah

In my case, I want to cite both publications in the same sentence, but I also want to know how to achieve this lettering if I were to cite these publications in different sentences.

I tried editing the year in the BibTeX citation entry to manually insert the a and b, but that results in this

blah blah Author (n.d.; n.d.) blah blah
Bornstein answered 27/4, 2020 at 21:17 Comment(0)
U
4

Hi mdawgig and welcome to Stack Overflow!
Here are two examples of what the entries (same author, same year) in BibTeX file (.bib) might look like:

@article{Author_2015a,
    Author = {Author, A. and Another, B.},
    Journal = {Amazing Journal},
    Pages = {50-100},
    Title = {A New Paper},
    Volume = {5},
    Year = {2015}
}

@article{Author_2015b,
    Author = {Author, A. and Another, C.},
    Journal = {Another Amazing Journal},
    Pages = {100-150},
    Title = {Another New Paper},
    Volume = {7},
    Year = {2015}
}

In R Markdown document, a line like this:

# using minus ( - ) sign before the @ will suppress author's name  
blah blah Author [-@Author_2015a; -@Author_2015b] blah blah

should return desired result (citing both publications in the same sentence):

blah blah Author (2015a, 2015b) blah blah

I also want to know how to achieve this lettering if I were to cite these publications in different sentences.

There are many R Markdown resources out there. You may find some of these useful (Bibliographies and Citations, Bibliographies, Bibliographies and citations, Citations).

Let us know if this answer your question.

Underproduction answered 28/4, 2020 at 14:11 Comment(10)
Thanks for the reply, but my .bib file and R Markdown references look like that as far as I can tell, but the error persists. Both .bib are like: @Article{Hansen2015a, author = {Hansen, Gretchen and Carpenter, Stephen and Gaeta, Jereme and Hennessy, Joseph and Vander Zanden, Jake}, journal = {Canadian Journal of Fisheries and Aquatic Sciences}, title = {Predicting walleye recruitment as a tool for prioritizing management actions}, year = {2015}, pages = {661-672}, volume = {72}, } In-text: in Hansen et al. [-@Hansen2015a; -@Hansen2015b]Bornstein
I can perfectly reproduce your citations. As far as i know, Pandoc generates citations in R Markdown documents. Do you have Rstudio updated (also, rmarkdown and knitr packages)?Caporetto
My rmarkdown and knitr were up to date, but I did update Rstudio to no avail. The output remains Hansen et al. (2015; 2015).Bornstein
Did you try installing RStudio Preview? It will automatically includes/download latest Pandoc version.Caporetto
I updated to Preview and the citations are the same.Bornstein
Just to be clear, do you have both references: @Article{Hansen2015a, ... } and @Article{Hansen2015b, ... } in the same .bib file with the same year = {2015}?Caporetto
That is correct. Same file, year is {2015} for both.Bornstein
It's just an hint... open your .bib file with RStudio, then go to menu: File > Save with Encoding... and then choose UTF-8 encoding as default. Knit your .Rmd file...Caporetto
Also, try creating the essential .Rmd and minimal .bib file (just containing examples above)...Caporetto
Well, I think I've identified the source of the problem. I had forgotten since I put the citation in that the two papers don't have the exact same set of authors; the second has all the same authors and one additional author. Thus, even though they both have the same in-text citation for author (Hansen et al.), they technically do not have the same authors, and thus RMarkdown seems to be acting correctly when it outputs (2015; 2015). My problem has gone from a technical one to a citation style guide one. Thanks; compiling a minimal .bib file is what made me catch on to this.Bornstein

© 2022 - 2024 — McMap. All rights reserved.