Skip to content

Commit

Permalink
fix #424: if the error "Undefined control sequence" comes from l3back…
Browse files Browse the repository at this point in the history
…end, let tinytex try to reinstall l3backend, which will trigger `tlmgr_update()` that runs `fmtutil-sys` to fix the L3 programming layer mismatch issue (although 5946a2a has guarded against it)
  • Loading branch information
yihui committed Oct 19, 2023
1 parent 7f8751d commit 3495cb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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.48.1
Version: 0.48.2
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),
person(given = "Posit Software, PBC", role = c("cph", "fnd")),
Expand Down
9 changes: 9 additions & 0 deletions R/latex.R
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,10 @@ regex_errors = function() {
# when a required tikz library is missing
'.* (tikzlibrary[^ ]+?[.]code[.]tex).*'
),
l3backend = c(
# L3 programming layer mismatch (#424)
'^File: ([^ ]+) \\d{4,}-\\d{2}-\\d{2} .*$'
),
style = c(
# missing .sty or commands
".* Loading '([^']+)' aborted!",
Expand All @@ -614,6 +618,11 @@ detect_files = function(text) {
v = grep_sub(p, '\\1', x)
if (length(v) == 0) return(v)
if (p == r$tikz && length(grep('! Package tikz Error:', text)) == 0) return()
# if the problem is caused by the L3 programming layer mismatch, use the
# last found file before the error line, which should be from l3backend
if (p == r$l3backend) return(
if (length(grep('^! Undefined control sequence', text)) > 0) tail(v, 1)
)
# these are some known filenames
for (i in c('epstopdf', grep('[.]', names(r), value = TRUE))) {
if (p %in% r[[i]]) return(i)
Expand Down

0 comments on commit 3495cb8

Please sign in to comment.