RMarkdown image floating

南楼画角 提交于 2021-01-05 11:26:32

问题


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"
---

one small paragraph here

![test image](linktoimage)\newline

another paragraph below the image

here if i use \newlinemy 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.

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.

Many thanks in advance.

floating and it is all knitted at the end or in random place


回答1:


EDIT: 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.

Or

test image

  ![](linktoimage)\newline

To have the caption on the top left of the image



来源:https://stackoverflow.com/questions/65133804/rmarkdown-image-floating

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!