cboettig / knitcitations

:package: Generate citations for knitr markdown and html files
http://carlboettiger.info
Other
220 stars 28 forks source link

citep() does not print forced author names #53

Closed hanowell closed 10 years ago

hanowell commented 10 years ago

write.bibtex(c(rstan = citation("rstan"))) bib <- read.bibtex("knitcitations.bibtex")

resulting bibtex file looks like this:

@Misc{rstan1, title = {Stan: A C++ Library for Probability and Sampling, Version 2.2.0}, author = {{Stan Development Team}}, year = {2013}, url = {http://mc-stan.org/}, numeral = {1}, } @Manual{rstan2, title = {Stan Modeling Language User's Guide and Reference Manual, Version 2.2.0}, author = {{Stan Development Team}}, year = {2013}, url = {http://mc-stan.org/}, numeral = {1}, } @Article{rstan3, title = {The No-U-Turn Sampler: Adaptively Setting Path Lengths in Hamiltonian Monte Carlo}, author = {{Matthew D. Hoffman} and {Andrew Gelman}}, year = {In press}, journal = {Journal of Machine Learning Research}, numeral = {1}, }

citep(bib["rstan1"]) citep(bib["rstan2"]) citep(bib["rstan3"])

Results in an empty parenthesis.

citep(list(bib["rstan1"], bib["rstan2"]))

results in (;)

cboettig commented 10 years ago

Sorry about that -- citep is not printing anything because it tries to cite by last names, while each of these names are ending up entirely in the given names slot of the R person object. I can see what I can do, but that is happening largely because of code external to knitcitations.

It appears rstan must not be using the newer authors@R format, making it more difficult for R to correctly parse the names in the citation. Further, the write.bib and read.bib functions from the bibtex package don't manage to parse the names into first and last names either.

write.bibtex

hanowell commented 10 years ago

Thanks for the head up, Carl. Also, thanks for a kickass package. I use it every day.

Ben Hanowell, MA, PhC,

Biocultural Anthropology Program, Department of Anthropology, University of Washington

On Tue, Apr 1, 2014 at 7:05 PM, Carl Boettiger notifications@github.comwrote:

Sorry about that -- citep is not printing anything because it tries to cite by last names, while each of these names are ending up entirely in the given names slot of the R person object. I can see what I can do, but that is happening largely because of code external to knitcitations.

It appears rstan must not be using the newer authors@R format, making it more difficult for R to correctly parse the names in the citation. Further, the write.bib and read.bib functions from the bibtex package don't manage to parse the names into first and last names either.

write.bibtex

Reply to this email directly or view it on GitHubhttps://github.com/cboettig/knitcitations/issues/53#issuecomment-39281992 .

cboettig commented 10 years ago

@BrashEQLibrium Digging a bit deeper since this puzzled me. The problem isn't anything do to the bibtex package, but just to the rstan citation file: https://github.com/stan-dev/rstan/issues/60 (If you remove the inner brackets in the bibtex citation then read.bib does the correct thing.

Meanwhile, knitcitations should be doing something more intelligent when the family name (or other values) return NULL, which I've opened a ticket for in issue #54. Thanks for the bug report; I'll close this now as the next steps will depend on the overhaul of the printing engine from #54.