From Kurt.Hornik at wu.ac.at  Sat Jan  8 15:37:44 2011
From: Kurt.Hornik at wu.ac.at (Kurt Hornik)
Date: Sat, 8 Jan 2011 15:37:44 +0100
Subject: [Rd] print.citation, small bug?
In-Reply-To: <AANLkTikWuMGpaVe3V=FYyY=O8B78mZ-N-OeqqsevKO_p@mail.gmail.com>
References: <AANLkTikWuMGpaVe3V=FYyY=O8B78mZ-N-OeqqsevKO_p@mail.gmail.com>
Message-ID: <19752.30392.547095.678117@fangorn.hornik.net>

>>>>> Nicholas Lewin-Koh writes:

Thanks.  Changed in r-devel now.

Best
-k

> Hi,
> I use Sweave extensively in my consulting work. When submitting reports to
> the scientists I work
> with I like to use the citation function to reference any packages I use, to
> give proper acknowledgement.
> I noted in the documentation that a  citation inherits from bibentry, and
> indeed,
>> citr<- citation()
>> class(citr)
> [1] "citation" "bibentry"

> However, following this line I would assume citation should fully inherit
> the methods of bibentry. But that is not the case,
>> print(citr, style="latex")
> still gives style='citation'

>> utils:::print.citation
> function (x, ...)
> {
>     NextMethod("print", x, style = "citation")
>     invisible(x)
> }
> <environment: namespace:utils>

> The citation print style is hard coded. Of course a workaround is,
> class(citr) <- 'bibentry'
> but I think it would be better if print inherited all bibentry methods,
> something like

> print.citation <- function (x, style="citation" ...)
> {
>     NextMethod("print", x, style = style, ...)
>     invisible(x)
> }

> Then the default is still printing a citation, but other print methods are
> available.

> Thanks
> Nicholas

> -- 
> "The bear and the goat were married and lived together until the end of
> their days. Either the goat went mad or the bear became sane."

> Nicholas Lewin-Koh
> Genentech

> 	[[alternative HTML version deleted]]

> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] print.citation, small bug?
Kurt Hornik