Search code examples
rr-markdowncitations

Citing multiple publications by same author in same year in RMarkdown


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

Solution

  • 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.