From 5946a2a1bf3c6ecefbd1213178a4e473ff4c26dc Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Wed, 24 Mar 2021 11:21:19 -0500 Subject: [PATCH] fix #291: detect the l3kernel package from the error message about expl3.sty, and update existing packages when they are required to be installed, since they might be too old to lose compatibility with other packages --- DESCRIPTION | 2 +- R/latex.R | 1 + R/tlmgr.R | 9 +++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8eb6cc17e..e716251b6 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.30.1 +Version: 0.30.2 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/latex.R b/R/latex.R index 04b6da963..106f1673b 100644 --- a/R/latex.R +++ b/R/latex.R @@ -531,6 +531,7 @@ detect_files = function(text) { '.* (tikzlibrary[^ ]+?[.]code[.]tex).*', + ".* Loading '([^']+)' aborted!", ".*! LaTeX Error: File `([^']+)' not found.*", ".* file ['`]?([^' ]+)'? not found.*", '.*the language definition file ([^ ]+) .*', diff --git a/R/tlmgr.R b/R/tlmgr.R index dc8892e67..38f41a871 100644 --- a/R/tlmgr.R +++ b/R/tlmgr.R @@ -106,9 +106,14 @@ tlmgr_search = function(what, file = TRUE, all = FALSE, global = TRUE, word = FA tlmgr_install = function(pkgs = character(), usermode = FALSE, path = !usermode && os != 'windows', ...) { if (length(pkgs) == 0) return(invisible(0L)) + update_pkgs = function(...) tlmgr_update(..., usermode = usermode) + + # if any packages have been installed, update packages first + if (any(check_installed(pkgs))) update_pkgs() + res = tlmgr(c('install', pkgs), usermode, ...) - if (res != 0 || !check_installed(pkgs)) { - tlmgr_update(all = FALSE, usermode = usermode) + if (res != 0 || any(!check_installed(pkgs))) { + update_pkgs(all = FALSE) # update tlmgr itself since it might be outdated res = tlmgr(c('install', pkgs), usermode, ...) } if ('epstopdf' %in% pkgs && is_unix() && Sys.which('gs') == '') {