简体   繁体   English

在 RMarkdown 字输出中的文本下编织的图像

[英]Image knitted under text in RMarkdown word output

I am writing a docx file using RMarkdown and all images I insert, appear under the text that come before each of them.我正在使用 RMarkdown 编写一个 docx 文件,我插入的所有图像都出现在每个图像之前的文本下方。 They correct their placement once I adjust it manually in the output document.一旦我在输出文档中手动调整它们,它们就会纠正它们的位置。

错误道

I am using the include_graphics() function to insert the image, and this is more or less what I have.我正在使用include_graphics()函数来插入图像,这或多或少就是我所拥有的。

# Title 1

## Title 2

Some text

```{r}

include_graphics("img.png")

```

In the end, I need it to be like this:最后,我需要它是这样的:

正确的路

Try this, which assumes your image is in the project directory:试试这个,假设你的图像在项目目录中:

---
output: word_document
---

# Heading 1

Text


## Heading 2

Text 2

Next paragraph




```{r results='asis', echo=FALSE, out.width="60mm"}

knitr::include_graphics("img.png")

```


Paragraph after image

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM