首页 > 解决方案 > 工具未安装或不在 PATH 中:pdfcrop

问题描述

我是 R 新手,只是尝试将我的第一个 R Markdown 编成 pdf 作为我正在做的课程的一部分。卡住了警告消息(下面以粗体突出显示)。生成了 Pdf,但是该图根本没有被裁剪。看起来 RStudio 以某种方式无法找到 pdfcrop,尽管它已安装。我认为将其添加到路径中可能会起作用,但不确定如何执行此操作。以前,通过运行 Sys.setenv(R_GSCMD="C:/Program Files/gs/gs9.54.0/bin/gswin64.exe") 解决了与 Ghostscript 相同的问题。

非常感谢任何帮助和输入。提前致谢。

我做的步骤:

  1. 从 LateX 发行版安装 TinyTex。
  2. 安装的 Ghostscript
  3. 使用 tinytex::tlmgr_install("pdfcrop") 安装 pdfcrop
  4. Sys.which('pdfcrop'),它给出了一个空字符串 - “”我正在使用 windows O/S 和 Rstudio。

已创建输出:MyFirstRMarkDown.pdf 警告消息:在 has_crop_tools() 中:工具未安装或不在 PATH 中:pdfcrop -> 因此,图形裁剪将被禁用。


下面是源文件:

---
title: "My first R Markdown doc"
author: Sanjukta Samom
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r cars}
summary(cars)
```

```{r} 
print("Hello World")
```

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

标签: rmarkdownrstudiopdf-generationtinytex

解决方案


推荐阅读