Reputation: 132
Is it possible to display a pdf file in an Rmarkdown file? Say, for example, a previously saved image myimage.pdf
What I am aiming is a form of
\includegraphics[width=0.5]{myimage.pdf}
Upvotes: 11
Views: 23998
Reputation: 275
For the record and as suggested in the comments, this works perfectly fine as long as you're knitting to pdf (this is a LaTex command that won't work if you try to knit to HTML or docx though):
\includegraphics[width = \textwidth]{myimage.pdf}
You can change the width with something like
\includegraphics[width = 0.5\textwidth]{myimage.pdf}
Upvotes: 0
Reputation: 3111
An update from the very end of 2017
It is possible to import a PDF image using knitr::include_graphics()
, e.g.
```{r label, out.width = "85%", fig.cap = "caption"}
include_graphics("path-to-your-image.pdf")
```
Upvotes: 7
Reputation: 105
You can insert this directly into your R Markdown. The alternate name will only be displayed if the image does not load.
![Alternate Name](file.pdf){width=500px}
Upvotes: 2