cboettig / knitcitations

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

In-text citation needs disambiguation letters added #22

Closed cboettig closed 11 years ago

cboettig commented 11 years ago

In-text citations do not disambiguate properly.

 l <- c("10.1098/rspb.2012.2085", "10.1111/j.1095-8649.2012.03464.x", "10.1111/j.2041-210X.2012.00247.x", "10.1098/rsif.2012.0125")
citet(l[2])
citet(l[3])

Both citations return Boettiger _et al_ (2012).

hpiwowar commented 11 years ago

Hi Carl. I'm a happy knitcitations user and trying to find a quick fix for this right now. Have repo on watch in case you implement it before I do....

cboettig commented 11 years ago

Thanks! Nice to know there are happy knitcitations users out there; the package is all a bit more beta than I'd like. Trying to eat my own dog food recently in hopes of exposing more of these bugs.

Solution will probably involve storing the in-text citation in the bibentry data.

Solution should also

cboettig commented 11 years ago

A hack solution meanwhile would be to pass a custom inline function to the the citation call. For instance,

inline_append <- function(char)
   function(entry)
    paste(knitcitations:::authoryear_t(entry), char) 

and call

citet(l[3], inline=inline_append("b"))

(or tweak the authoryear_t call further for better formatting).

Will see if I can think of an automated solution soon.