<!DOCTYPE html> <html> <!-- %\VignetteEngine{knitr::knitr} %\VignetteIndexEntry{RHTML Citations Example} --> <head> <title>RefManageR RHTML</title> <link rel="stylesheet" type="text/css" href="../../CRAN_web.css"/> <meta charset="UTF-8"> </head> <body> <h1>Add Citations to an R HTML Document and Print Bibliography</h1> <!--begin.rcode unload, include = FALSE ## Needed to clear internal package citation list from previous vignette builds unloadNamespace("RefManageR") end.rcode--> <!--begin.rcode setup, include = TRUE, cache = FALSE library(RefManageR) bib <- ReadBib(system.file("Bib", "biblatexExamples.bib", package = "RefManageR"), check = FALSE) bib2 <- ReadBib(system.file("Bib", "RJC.bib", package = "RefManageR"))[[seq_len(20)]] BibOptions(check.entries = FALSE, style = "html") end.rcode--> <p> This is an R HTML document. This is an example of a citation in the text <!--rinline Citet(bib, "loh") -->. Now we cite in parentheses <!--rinline AutoCite(bib, "baez/online", after = ", Ch. 2") -->. You can change the default options in a setup chunk at the start of the document or at any other point using the <code>BibOptions</code> function or by specifying options as a list in the <code>.opts</code> argument to the cite functions. For demonstration purposes, we switch back and forth between citation styles here just to show the possibilities. </p> <p> These are reports <!--rinline Citet(bib, bibtype = "Report", .opts = list(cite.style = "numeric", super = TRUE, hyperlink = "to.bib")) -->. Their hyperlinks go to their entry in the bibliography. The link for <!--rinline TextCite(bib, "markey") --> will take you to the document in a new window; this is the default, if a link is available (see <code>?open.BibEnty</code>). The following citation has no hyperlink <!--rinline AutoCite(bib, location = "Uppsala", .opts = list(hyperlink = FALSE)) -->. </p> <p> <!--rinline NoCite(bib = bib, title = "CTAN") -->I've added a reference to CTAN without citing it. Now I'm adding a reference from another bibliography (a second <code>BibEntry</code> object) <!--rinline AutoCite(bib2, title = "binary longitudinal data", .opts = list(cite.style = "authortitle")) -->. Look at all my Aristotle: <!--rinline TextCite(bib, author = "Aristotle", .opts = list(cite.style = "numeric", super = TRUE)) -->. Below is the <code>R</code> logo. </p> <p> <img src="https://cran.r-project.org/Rlogo.svg" alt="R logo" width="561" height="724"> </p> <p> Some papers on the arXiv are <!--rinline TextCite(bib, eprinttype = "arxiv", .opts = list(cite.style = "authoryear", bib.style = "authoryear", sorting = "nyt")) -->. </p> <h2>References</h2> <!--begin.rcode results = "asis", echo = FALSE PrintBibliography(bib, .opts = list(check.entries = FALSE, bib.style = "draft")) end.rcode--> <h2>More References</h2> <!--begin.rcode results = "asis", echo = FALSE PrintBibliography(bib2) end.rcode--> </body> </html>