Skip to content

Commit

Permalink
close #179: add an argument add_path to install_tinytex() so users ca…
Browse files Browse the repository at this point in the history
…n disable `tlmgr path add`
  • Loading branch information
yihui committed Feb 24, 2020
1 parent fe0eb01 commit 626e2b9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),
person(family = "RStudio, PBC", role = "cph"),
Expand Down
9 changes: 6 additions & 3 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion man/install_tinytex.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 626e2b9

Please sign in to comment.