RMarkdown 图像浮动 [英] RMarkdown image floating
问题描述
我正在尝试在 Rmarkdown 中创建分析报告,但我被困在这里,下面是我正在处理的示例
I am trying to create an analysis report in Rmarkdown and I am stuck here , below is the example of what I am working on
---
output: "pdf_document"
---
这里有一小段
![test image](linktoimage)\newline
图片下方的另一段
在这里,如果我使用 \newline
我的图像按预期放置在段落之间但标题丢失,否则如果我删除 \newline
我的图像随机放置在渲染文档后的底部.
here if i use \newline
my image is placed as expected between the paragraphs but the caption is missing else if i remove\newline
my image is randomly placed at the bottom after rendering the document.
请帮助我,我尝试将 extra_dependencies: "float"
放在 YAML 标头中,结果仍然相同.我在 emacs 编辑器中工作,并且使用的是基本的 Markdown 语言而不是 r 块.请帮助我在这里缺少的东西让我的图片带有标题而不是浮动.
Kindly help me , I tried placing extra_dependencies: "float"
in the YAML header still the result is same. I am working in emacs editor and am using basic markdown language and not r chunks. Kindly help me what I am missing here to get my images in place with caption and not floating.
非常感谢.
漂浮的,都是编织在末端或随机的地方
floating and it is all knitted at the end or in random place
推荐答案
了解更多关于浮动图像的信息:在您的第一个块中尝试 knitr::opts_chunk$set(fig.pos = "!H", out.extra = "")
.fig.pos
控制浮动,!H
停止在文档内浮动.
Found out more about floating images:
Try knitr::opts_chunk$set(fig.pos = "!H", out.extra = "")
in your first chunk. fig.pos
controls floating, and !H
stops floating within the document.
我不确定为什么您的图片被随机放置.但这可能是因为图像大小.不过试试
I am not sure why your image is being randomly placed. But it could be because of the image size. But try
![](linktoimage)
test image
在图像的底部/中心有标题.或者
to have the caption on the bottom/center of the image. Or
![](linktoimage)\newline
test image
在图片的左下角有标题.
to have the caption on the bottom left of the image.
或
test image
![](linktoimage)\newline
图片左上角的标题
这篇关于RMarkdown 图像浮动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!