R/sds_newword.R

Defines functions sds_newword

Documented in sds_newword

#' Define a new word in the text.
#'
#' Given a character from a special unicode or other font, translate it into a tex command if needed.
#'
#' @param str the character string for the new word
#' @param format either `"html"` or `"latex"`. Default uses `knitr::is_latex_output()`
#'
#'
#' @examples
#' sds_newword("log likelihood", format = "latex")
#'
#' @export

sds_newword <- function(str, format = ifelse(knitr::is_latex_output(), "latex", "html")){
  if (format == "html") return(sprintf("***%s***", str))
  else sprintf("\\underline{%s}", str)
}
dtkaplan/SDSdata documentation built on June 28, 2022, 8:09 a.m.