R/use_imbei_beamer.R

Defines functions use_imbei_beamer

Documented in use_imbei_beamer

#' use_imbei_beamer
#' 
#' Facilitates the use of the IMBEI beamer template. 
#' This is an alternative to creating a new markdown from template directly. 
#' Latter is preferred.
#'
#' @param keep_tex Logical, defines whether the tex file is kept. Defaults to TRUE
#' @param copy_to File path for beamer template. Defaults to getwd()
#'
#' @return Creates a tex and prints out the suggested yaml content
#' @export
#'
#' @examples
#' use_imbei_beamer()
use_imbei_beamer <- function(keep_tex = TRUE, copy_to = getwd()) {
  # copy the template from IMBEImisc to the current location
  invisible(
    file.copy(
      from = system.file("rmarkdown/templates/IMBEI_beamer_short/skeleton",
                         "IMBEI_beamer_short_template.tex",package = "IMBEImisc"),
      to = copy_to
    )
  )
  invisible(
      file.copy(
      from = system.file("rmarkdown/templates/IMBEI_beamer/skeleton",
                         "Universitaetsmedizin.jpg",package = "IMBEImisc"),
      to = copy_to
    )
  )
  
  
  # suggest yaml added lines
  message("\nCopy these lines into the YAML header of your .Rmd file")
  
  message(
    paste0(
    '
---\ntitle: "Your Title"\nauthor: "Your name"\ndate: "Date"\noutput:  \n  beamer_presentation:\n    template: IMBEI_beamer_template.tex\n    keep_tex: ', keep_tex,'\n    slide_level: 2\n---
    '
    )
  )
  
  
  
}
imbeimainz/IMBEImisc documentation built on Nov. 14, 2024, 1:22 p.m.