rstudio knitr 不是 运行 pdfcrop
rstudio knitr not running pdfcrop
我正在尝试使用 rstudio (1.2.5019) 将下面的 mwe 编织成 pdf
---
title: "Test"
author: "Me"
output:
pdf_document:
fig_caption: yes
keep_tex: yes
fig_crop: yes
---
This should be cropped
```{r}
library(knitr)
```
```{r named-chunk}
plot(x <- 0:100, dbinom(x, size=100, prob=0.6), type='l',
main="Not cropped", xlab="Looks good", ylab="Nok")
```
输出的 pdf 看起来不错,只是绘图没有用 pdfcrop 裁剪。
这是日志输出。
processing file: cropping.Rmd |..................
| 25% ordinary text without R code
|...................................
| 50% label: unnamed-chunk-1
|....................................................
| 75% ordinary text without R code
|......................................................................|
100% label: named-chunk
output file: cropping.knit.md
"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS
cropping.utf8.md --to latex --from
markdown+autolink_bare_uris+tex_math_single_backslash --output
cropping.tex --self-contained --highlight-style tango --pdf-engine
pdflatex --variable graphics --lua-filter
"C:/Users/marti/Documents/R/win-library/3.6/rmarkdown/rmd/lua/pagebreak.lua"
--lua-filter "C:/Users/marti/Documents/R/win-library/3.6/rmarkdown/rmd/lua/latex-div.lua"
--variable "geometry:margin=1in"
Output created: cropping.pdf
pdfcrop 在我的命令行中工作得很好,但 rstudio 没有调用它。它也位于 rstudio.
Sys.which('pdfcrop')
pdfcrop
"C:\texlive19\bin\win32\pdfcrop.exe"
我错过了什么?
这实际上解决了它。
``` {r crop-hook,cache=FALSE}
knit_hooks$set(crop=hook_pdfcrop)
```
```{r named-chunk, crop=TRUE}
plot(x <- 0:100, dbinom(x, size=100, prob=0.6), type='l',
main="Not cropped", xlab="Looks good", ylab="Nok")
```
据我从文档中了解到,这不是必需的吗?
通过 livetex
或 miktex
安装 pdfcrop
--- 您用来编写乳胶文档的那个。
我正在尝试使用 rstudio (1.2.5019) 将下面的 mwe 编织成 pdf
---
title: "Test"
author: "Me"
output:
pdf_document:
fig_caption: yes
keep_tex: yes
fig_crop: yes
---
This should be cropped
```{r}
library(knitr)
```
```{r named-chunk}
plot(x <- 0:100, dbinom(x, size=100, prob=0.6), type='l',
main="Not cropped", xlab="Looks good", ylab="Nok")
```
输出的 pdf 看起来不错,只是绘图没有用 pdfcrop 裁剪。
这是日志输出。
processing file: cropping.Rmd |..................
| 25% ordinary text without R code|...................................
| 50% label: unnamed-chunk-1
|....................................................
| 75% ordinary text without R code|......................................................................| 100% label: named-chunk
output file: cropping.knit.md
"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS cropping.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output cropping.tex --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --lua-filter "C:/Users/marti/Documents/R/win-library/3.6/rmarkdown/rmd/lua/pagebreak.lua" --lua-filter "C:/Users/marti/Documents/R/win-library/3.6/rmarkdown/rmd/lua/latex-div.lua" --variable "geometry:margin=1in"
Output created: cropping.pdf
pdfcrop 在我的命令行中工作得很好,但 rstudio 没有调用它。它也位于 rstudio.
Sys.which('pdfcrop') pdfcrop "C:\texlive19\bin\win32\pdfcrop.exe"
我错过了什么?
这实际上解决了它。
``` {r crop-hook,cache=FALSE}
knit_hooks$set(crop=hook_pdfcrop)
```
```{r named-chunk, crop=TRUE}
plot(x <- 0:100, dbinom(x, size=100, prob=0.6), type='l',
main="Not cropped", xlab="Looks good", ylab="Nok")
```
据我从文档中了解到,这不是必需的吗?
通过 livetex
或 miktex
安装 pdfcrop
--- 您用来编写乳胶文档的那个。