工具未安装或不在路径中:pdfcrop

问题描述

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

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

我做的步骤:

  1. 从 LateX 发行版安装 TinyTex。
  2. 已安装的 Ghostscript
  3. 使用 tinytex::tlmgr_install("pdfcrop") 安装 pdfcrop
  4. Sys.which('pdfcrop'),它给出一个空字符串 - "" 我使用的是 Windows 操作系统和 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.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)