diff --git a/DESCRIPTION b/DESCRIPTION index 2845aad14..a105ffc26 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: tinytex Type: Package Title: Helper Functions to Install and Maintain 'TeX Live', and Compile 'LaTeX' Documents -Version: 0.19.3 +Version: 0.19.4 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person(family = "RStudio, PBC", role = "cph"), diff --git a/R/install.R b/R/install.R index 26e2c1874..95b9d3add 100644 --- a/R/install.R +++ b/R/install.R @@ -19,11 +19,14 @@ #' list of mirrors at \url{https://ctan.org/mirrors}. #' @param extra_packages A character vector of extra LaTeX packages to be #' installed. +#' @param add_path Whether to run the command \command{tlmgr path add} to add +#' the bin path of TeX Live to the system environment variable \var{PATH}. #' @references See the TinyTeX documentation (\url{https://yihui.org/tinytex/}) #' for the default installation directories on different platforms. #' @export install_tinytex = function( - force = FALSE, dir = 'auto', repository = 'ctan', extra_packages = NULL + force = FALSE, dir = 'auto', repository = 'ctan', extra_packages = NULL, + add_path = TRUE ) { if (!is.logical(force)) stop('The argument "force" must take a logical value.') check_dir = function(dir) { @@ -135,7 +138,7 @@ install_tinytex = function( target = user_dir } bin = file.path(list.files(file.path(target, 'bin'), full.names = TRUE), 'tlmgr') - system2(bin, c('path', 'add')) + if (add_path) system2(bin, c('path', 'add')) if (length(extra_packages)) system2(bin, c('install', extra_packages)) add_texmf(bin) message('TinyTeX installed to ', target) @@ -184,7 +187,7 @@ install_tinytex = function( } } tlmgr(c('install', 'latex-bin', 'xetex', pkgs_custom, extra_packages)) - tlmgr(c('path', 'add')) + if (add_path) tlmgr(c('path', 'add')) add_texmf(bin_tlmgr) }) message('TinyTeX installed to ', target) diff --git a/man/install_tinytex.Rd b/man/install_tinytex.Rd index 29465df1d..dae8beb13 100644 --- a/man/install_tinytex.Rd +++ b/man/install_tinytex.Rd @@ -11,7 +11,8 @@ install_tinytex( force = FALSE, dir = "auto", repository = "ctan", - extra_packages = NULL + extra_packages = NULL, + add_path = TRUE ) uninstall_tinytex(force = FALSE, dir = tinytex_root()) @@ -37,6 +38,9 @@ list of mirrors at \url{https://ctan.org/mirrors}.} \item{extra_packages}{A character vector of extra LaTeX packages to be installed.} +\item{add_path}{Whether to run the command \command{tlmgr path add} to add +the bin path of TeX Live to the system environment variable \var{PATH}.} + \item{packages}{Whether to reinstall all currently installed packages.} \item{...}{Other arguments to be passed to \code{install_tinytex()} (note