Domanda

I'm trying to make a bibliography in markdown. To build the bibliography, I'm using the knitr package and pandoc in R to convert a .Rmd file to a PDF.

The entries in my .bib file look like these, taken from http://johnmacfarlane.net/pandoc/demo/biblio.bib:

@Book{item1,
author="John Doe",
title="First Book",
year="2005",
address="Cambridge",
publisher="Cambridge University Press"
}

@Article{item2,
author="John Doe",
title="Article",
year="2006",
journal="Journal of Generic Studies",
volume="6",
pages="33-34"
}

To build my bibliography, I'm using the following function, taken from: http://quantifyingmemory.blogspot.co.il/2013/02/reproducible-research-with-r-knitr.html

knitsPDF <- function(name) {
  library(knitr)
  knit(paste0(name, ".Rmd"), encoding = "utf-8")
  system(paste0("pandoc -o ", name, ".pdf ", name, ".md --bibliography /Users/.../Desktop/test.bib --csl /Users/.../Desktop/taylor-and-francis-harvard-x.csl"))
}

The contents of my .Rmd file is

This is some text [@item1]

This is more text [@item2]

References

And the contents of the output PDF is:

This is some text (Doe 2005)
This is more text (Doe 2006)

Bibliography
Doe, J. et al., 2005. First Book. Cambridge: Cambridge University Press. 

Doe, J. et al., 2006. Article. Journal of Generic Studies, 6, 33–34.

Note the 'et al' appearing in bibliography. Why is et al appearing and how can I stop it appearing? I need bibliography to be:

Bibliography
    Doe, J., 2005. First Book. Cambridge: Cambridge University Press. 

    Doe, J., 2006. Article. Journal of Generic Studies, 6, 33–34.
È stato utile?

Soluzione

Indeed this was just a problem with the style file. Downloading this style file: http://www.zotero.org/styles/harvard-durham-university-business-school

and changing this code

knitsPDF <- function(name) {
  library(knitr)
  knit(paste0(name, ".Rmd"), encoding = "utf-8")
  system(paste0("pandoc -o ", name, ".pdf ", name, ".md --bibliography /Users/.../Desktop/test.bib --csl /Users/.../Desktop/harvard-durham-university-business-school.csl"))
}

solved the problem

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top