使用乳胶的Rmarkdown pdf生成中的图像大小控制 [英] Image size control in Rmarkdown pdf generation with latex
问题描述
我正在使用Rmarkdownv2生成带有一些本地图像的pdf文件.但是,与html相比,在渲染的pdf中,图片似乎已转换为具有较低分辨率的较大尺寸.我当前用于图像的代码是这样的:
![alt text](figures/fig1.png)
I'm using Rmarkdownv2 to generate a pdf file with some local images. But it seems that the image was converted to a larger size with lower resolution in the rendered pdf, compared to the html. The code I'm currently using for the image is something like:
![alt text](figures/fig1.png)
有什么方法可以控制pdf中的图像大小?我也尝试过
Is there any way to control the image size in the pdf? I also tried
pdf_document:
fig_height: 1
fig_width: 2
pdf_document:
fig_height: 1
fig_width: 2
但这没用.预先感谢.
推荐答案
您可以使用的开发版本knitr (> = v1.11.22)和include_graphics()
函数,例如
You can use the development version of knitr (>= v1.11.22) and the include_graphics()
function, e.g.
```{r out.width='70%'}
knitr::include_graphics('figures/fig1.png')
```
如果需要图形标题,只需使用块选项fig.cap = 'A figure caption.'
If you want a figure caption, just use the chunk option fig.cap = 'A figure caption.'
这篇关于使用乳胶的Rmarkdown pdf生成中的图像大小控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!