Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
dmurdoch committed Oct 30, 2024
2 parents 2af494c + 06d2dbe commit ad8280b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/save_kable.R
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ save_kable_latex <- function(x, file, latex_header_includes, keep_tex, density)
file_no_ext <- tools::file_path_sans_ext(temp_tex_file)

owd <- setwd(dirname(temp_tex_file))
on.exit(setwd(owd), add = TRUE)

if (!keep_tex) {
temp_file_delete <- paste0(file_no_ext, c(".tex", ".aux", ".log"))
on.exit(unlink(temp_file_delete), add = TRUE)
}

if (!requireNamespace("tinytex", quietly = TRUE)) {
system(paste0("xelatex -interaction=batchmode ",
Expand All @@ -260,10 +266,6 @@ save_kable_latex <- function(x, file, latex_header_includes, keep_tex, density)
tinytex::xelatex(gsub(pattern = " ", replacement = "\\ ",
temp_tex_file, fixed = TRUE))
}
if (!keep_tex) {
temp_file_delete <- paste0(file_no_ext, c(".tex", ".aux", ".log"))
unlink(temp_file_delete)
}

table_img_info <- NULL
if (tools::file_ext(file) != "pdf") {
Expand All @@ -285,8 +287,6 @@ save_kable_latex <- function(x, file, latex_header_includes, keep_tex, density)
density = density)
}

setwd(owd)

out <- paste0(file_no_ext, ".", tools::file_ext(file))
attr(out, "info") <- table_img_info
return(invisible(out))
Expand Down

0 comments on commit ad8280b

Please sign in to comment.