find_resource <- function(template, file = 'template.tex') {
res <- system.file(
"rmarkdown", "templates", template, "resources", file, package = "CHL5202"
)
if (res == "") stop(
"Couldn't find template file ", template, "/resources/", file, call. = FALSE
)
res
}
#' @title Place References.
#'
#' @description Function for placing references. This function writes LaTeX and HTML code behind-the-scenes so you don't have to.
#'
#' @param x String to be rendered by \code{knitr::\link[knitr]{asis_output}}.
#'
#' @return NULL
#'
#' @examples
#' \dontrun{
#' refs_here()
#' }
#'
#' @export
refs_here <- function(x = '') {
assertthat::assert_that(is.character(x))
if (knitr::is_latex_output()) {
x <- glue::glue(
'\\noindent',
'\\setlength{\\parindent}{-0.20in}',
'\\setlength{\\leftskip}{0.20in}',
'\\setlength{\\parskip}{8pt}',
'<<x>>',
'<div id="refs"></div>',
.sep = '\n', .open = '<<', .close = '>>'
)
knitr::asis_output(x)
} else {
knitr::asis_output(
glue::glue('{x}', '<div id="refs"></div>', .sep = '\n')
)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.