From the course: Creating Reports and Presentations with R Markdown and RStudio

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Inserting images using raw LaTeX

Inserting images using raw LaTeX - RStudio Tutorial

From the course: Creating Reports and Presentations with R Markdown and RStudio

Start my 1-month free trial

Inserting images using raw LaTeX

- [Narrator] If you want fine-grain control over how images are displayed and sized in PDF files, you will need to write some raw LaTeX. Let's go through the basics of doing that by opening up our exercise files and navigating to 07_03. Let's open up our RStudio project, and I want to start with the very basics of using LaTeX to insert graphics. So I'll go to File, New File and select RMarkdown. I'll select PDF Document and I'll hit Okay. I want to get rid of all this fluff in my document from lines 10 down to the bottom. Now, let's concentrate on just the RMarkdown file by pressing Ctrl+Shift+1 and I'll write a little bit of text, saying here's the Rmarkdown hex sticker. And we use a function from LaTeX called includegraphics and we provide the path to our image in braces. So that's images/rmarkdown-sticker.png. Let's save our document with Cmd+S and call it raw-latex-for-images. And now, let's knit our document together. And we can see, we've embedded our image into our PDF. Let's…

Contents