Skip to content

Commit

Permalink
enable figure cropping in pdf_document() only when both pdfcrop and g…
Browse files Browse the repository at this point in the history
…hostscript are found (yihui/knitr#954), and do not limit this feature to non-Windows platforms
  • Loading branch information
yihui committed Sep 9, 2020
1 parent fdfb39a commit f45bb70
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rmarkdown
Type: Package
Title: Dynamic Documents for R
Version: 2.3.3
Version: 2.3.4
Authors@R: c(
person("JJ", "Allaire", role = "aut", email = "[email protected]"),
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ rmarkdown 2.4

- Added the `number_sections` argument to the `word_document()` output format. This requires Pandoc >= v2.10.1, and is set to `FALSE` by default (thanks, @jooyoungseo, #1869).

- For the output format `pdf_document`, the option `fig_crop` will not be enabled unless both the programs `pdfcrop` and `ghostscript` are found (thanks, @dalupus, yihui/knitr#954).


rmarkdown 2.3
================================================================================
Expand Down
4 changes: 2 additions & 2 deletions R/output_format.R
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ knitr_options_pdf <- function(fig_width,

knit_hooks <- NULL

# apply cropping if requested and we have pdfcrop
crop <- fig_crop && !is_windows() && nzchar(find_program("pdfcrop"))
# apply cropping if requested and we have pdfcrop and ghostscript
crop <- fig_crop && find_program("pdfcrop") != '' && tools::find_gs_cmd() != ''
if (crop) {
knit_hooks = list(crop = knitr::hook_pdfcrop)
opts_chunk$crop = TRUE
Expand Down

0 comments on commit f45bb70

Please sign in to comment.