From 2b4bc30d14a86b3b27bd8f5351b9900baed7cac2 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Fri, 9 Feb 2024 10:08:11 -0600 Subject: [PATCH] fix rstudio/tinytex#435: adjust PATH temporarily for pdf_crop() to be able to find the command `pdfcrop` from TinyTeX --- DESCRIPTION | 2 +- NEWS.md | 2 ++ R/plot.R | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 109477fe0f..e8903d0428 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: knitr Type: Package Title: A General-Purpose Package for Dynamic Report Generation in R -Version: 1.45.12 +Version: 1.45.13 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person("Abhraneel", "Sarma", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index 74a9e52247..228fc1e587 100644 --- a/NEWS.md +++ b/NEWS.md @@ -22,6 +22,8 @@ - `include_graphics()` may provide an incorrect plot width to LaTeX when the locale setting for `LC_NUMERIC` is not `C` because the decimal separator may not be a dot (thanks, @tdhock, rstudio/rmarkdown#2525). +- When TinyTeX and the LaTeX package **pdfcrop** are installed, `knitr::pdf_crop()` is unable to find `pdfcrop` (thanks, @dmkaplan2000, rstudio/tinytex#435). + ## MAJOR CHANGES - Unbalanced chunk delimiters (fences) in R Markdown documents are no longer allowed, as announced two years ago at (#2306). This means the opening delimiter must strictly match the closing delimiter, e.g., if a code chunk starts with four backticks, it must also end with four; or if a chunk header is indented by two spaces, the closing fence must be indented by exactly two spaces. For authors who cannot update their R Markdown documents for any reason at the moment, setting `options(knitr.unbalanced.chunk = TRUE)` (e.g., in `.Rprofile`) can temporarily prevent **knitr** from throwing an error, but it is strongly recommended that you fix the problems as soon as possible, because this workaround will be removed in future. diff --git a/R/plot.R b/R/plot.R index a584f56c6d..c76481016d 100644 --- a/R/plot.R +++ b/R/plot.R @@ -373,6 +373,7 @@ plot_crop = function(x, quiet = TRUE) { is_pdf = grepl('[.]pdf$', x, ignore.case = TRUE) x2 = x x = path.expand(x) + tinytex:::tweak_path() # in case TinyTeX is installed but not on PATH if (is_pdf && !has_utility('pdfcrop')) return(x2) if (!quiet) message('cropping ', x)