Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rmarkdown Image Skips Ahead of Text

I am putting together an Rmarkdown PDF document with the following YAML settings:

---
output: 
  pdf_document:
    fig_caption: true 
    fig_crop: true
    toc_depth: 3
  header-includes:
  - \usepackage{hyperref}
 ---

Within the body of the document I've inserted a few PNG images, using the following syntax

Paragraph 1..........

![Caption](path/image.png)

Paragraph 2....

And when the document is rendered, the image appears as expected within the text, between Paragraph 1 and Paragraph 2. However, I am getting some unpredictable results where the rendered image appears after Paragraph 2 in some cases and I can't manage to solve it.

like image 346
Ryan Erwin Avatar asked Dec 08 '15 00:12

Ryan Erwin


1 Answers

I have run into the same problem. It appears if you wrap the image in "paragraph" tags, the image will be in-line with the text.

Paragraph 1...

<p>
![](image.png)
</p>

Paragraph 2...
like image 171
troh Avatar answered Sep 21 '22 19:09

troh