src/library/pkgbuild/R/latex.R

#' Is latex installed?
#'
#' Checks for presence of pdflatex on path.
#'
#' @export
has_latex <- function() {
  if (!is.null(fix <- getOption("PKGBUILD_TEST_FIXTURE_HAS_LATEX"))) {
    return(fix)
  }

  nzchar(Sys.which("pdflatex"))
}

#' @export
#' @rdname has_latex
check_latex <- function() {
  if (!has_latex()) {
    stop("LaTeX not installed (pdflatex not found)", call. = FALSE)
  }

  TRUE
}
r-lib/pkgman documentation built on Nov. 18, 2024, 2:23 p.m.