R/get_texpackages.R

Defines functions get_texpackages

Documented in get_texpackages

#' @title Get list of TeX packages installed on System
#' @export
#' @description Fetch all TeX packages currently installed on system
#' @details If OS is Windows function checks against MikTex else function checks against TexLive.
#' @return 
#' character
#' @examples
#' #head(get_texpackages())
#' @concept utils
#' @rdname get_texpackages
get_texpackages <- function(){
  
  if(nzchar(Sys.which("tlmgr"))){
    
    x <- system('tlmgr list --only-installed',intern = TRUE)
    
    gsub('^i |:(.*?)$','',x)
    
  }else{
    
    if(!nzchar(Sys.which("mpm"))){
      system('mpm --list-package-names',intern = TRUE)
    }else{
      stop('neither tlmgr or mpm are installed and in %PATH%')
    }
    
  }
  
}

Try the texPreview package in your browser

Any scripts or data that you put into this service are public.

texPreview documentation built on May 29, 2024, 5:45 a.m.