R 如何更改文件中的图片大小

R 如何更改文件中的图片大小,r,r-markdown,R,R Markdown,我有一个rmarkdown文件,看起来像这样: --- title: "Playerreport" output: html_document: theme: null highlight: null css: styles.css --- <div class="container">![Caption for the picture.](C:\Users\Frits\Pictures\zlatan.jpg) </div> .contai

我有一个rmarkdown文件,看起来像这样:

--- 
title: "Playerreport"
output: 
 html_document:
  theme: null
  highlight: null
  css: styles.css
---
  <div class="container">![Caption for the picture.](C:\Users\Frits\Pictures\zlatan.jpg)    </div>
.container img{
    width: 100px;
    height: 120px;
}
现在我想在文件中包括一张图片。所以像这样:

--- 
title: "Playerreport"
output: 
 html_document:
  theme: null
  highlight: null
  css: styles.css
---
  <div class="container">![Caption for the picture.](C:\Users\Frits\Pictures\zlatan.jpg)    </div>
.container img{
    width: 100px;
    height: 120px;
}

但情况并没有改变。你知道哪里出了问题吗?css文件中的其他元素也可以工作。

您似乎在更改div的宽度和高度,而不是img。css应该是这样的:

--- 
title: "Playerreport"
output: 
 html_document:
  theme: null
  highlight: null
  css: styles.css
---
  <div class="container">![Caption for the picture.](C:\Users\Frits\Pictures\zlatan.jpg)    </div>
.container img{
    width: 100px;
    height: 120px;
}
对于此html:

<div class="container">
    <img src="image.png">
</div>

有一个本地pandoc降价解决方案。因为,您可以使用扩展来设置单个图像大小或为其指定一个类

在您的情况下,您可以对单个图像执行此操作(好处是它适用于每种输出格式):

如果必须以这种方式设置多个图像,则应使用原始css代码(仅适用于html输出):