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.citationfunction (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]]
>>>>> 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