R/start_ltx_options.R

Defines functions tocdepth sections_color start_ltx_options

Documented in sections_color start_ltx_options tocdepth

#' start_ltx_options
#'
#' Initialiser certaines options LTX au départ.
#'
#' @return Commandes LTX.
#' @keywords internal
#' @export
start_ltx_options <- function(){
  catx(sections_color("astral", c(87,146,204)),
       tocdepth(5))
}

#' sections_color
#'
#' Applique une couleur ayant un code RGB aux sections d'un document RMarkdown.
#'
#' @param x Nom de la variable contenant le code RGB.
#' @param rgb Code RGB. c(R, G, B)
#'
#' @return Code LaTeX à insérer dans un RMarkdown.
#' @keywords internal
#' @export
#' @examples
#' rmd_sections_color("astral", c(87,146,204))
sections_color <- function(x, rgb){
  paste0(
    "\\definecolor{",x,"}{RGB}{",paste(rgb, collapse = ","),"}\n",
    "\\allsectionsfont{\\color{",x,"}}"
  )
}

#' Sections table des matières
#'
#' Détermine jusqu'à quel niveau les sections sont affichées dans les vignettes du fichier PDF.
#'
#' @param x level maximal à afficher.
#'
#' @keywords internal
#' @export
tocdepth <- function(x){
  return(paste0("\\setcounter{tocdepth}{",x,"}"))
}
INESSS-QC/polymed1 documentation built on Aug. 4, 2020, 12:02 a.m.