Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Correctly check ghostscript for cropping on Windows #2246

@cderv

Description

@cderv

Follows discussions in rstudio/tinytex#391

We need to make knitr::plot_crop() conditional on windows to use the ghotscript internal to TeX Live. The internal ghostscript is not found by our detection because it is not expose in path (which is on purpose by Tex Live)

https://github.com/yihui/knitr/blame/1239f36c5dee8b0e029958a793ae71558902f52c/R/plot.R#L374

This is an adaptation of previous fix #954

But we may also need to reconsider in rmarkdown as we also check for ghostcript using tools::find_gs_cmd()
https://github.com/rstudio/rmarkdown/blob/0e794e35717c3be9637e2b0468bb97010d84b527/R/util.R#L318-L331

My understand is that

  • On windows we can expect (or check in Tex Live directory) that the internal ghostscript will be used - so no need to have it.
  • Otherwise we still need an external program

However, the use of internal ghostcript is conditional to Tex Live version as from rstudio/tinytex#391 this is not working and an external program should be used.

Maybe using grepl("TeX Live 2023", tinytex::tlmgr_version(FALSE)) ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions