I am attempting to use rmarkdown to generate a PDF via LaTeX. I am trying to insert a picture into the PDF, using LaTeX commands withing the RMarkdown document. I am using the LaTeX command wrapfigure
which is inserting the figure properly, but then forces text following the current section into a more narrow column, as shown here.
My PDF looks like:
text text text [image]
text text text
text text text
I want:
text text text [image]
text text text text text
text text text text text
The solution to that problem involved using a full LaTeX document, but I am required to use RMarkdown for my class, so that solution will not work for me. How to I get the proper full line formatting that I want, utilizing RMarkdown?
Code Example:
---
title: "Really Awesome Title"
author: "Some Guy"
date: "June 30, 2017"
output:
pdf_document: default
urlcolor: blue
header-includes:
- \usepackage{wrapfig}
---
\begin{wrapfigure}{R}{.25\textwidth}
\begin{center}
\includegraphics[width=.2\textwidth]{Dave_roberts.png}
\end{center}
\caption{Dave Roberts}
\end{wrapfigure}
## Introduction
Words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words.
### Areas of Interest
words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words .
### Analytic Technique
words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words
### Benefits of Analysis
words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words
UPDATE: A friend suggested that I needed to end the section of LaTeX code with a {R}. This made the margin error stop occurring, but it added the text "{R}" to my PDF.
Code now looks like:
\begin{wrapfigure}{R}{.25\textwidth}
\begin{center}
\includegraphics[width=.2\textwidth]{Dave_roberts.png}
\end{center}
\caption{Dave Roberts}
\end{wrapfigure}{R}
So, it appears to be a problem with ending the LaTeX call. Does anyone have an idea how to end the LaTeX call but not add text to the PDF?
Your problem comes from the position of your \end{center}
argument which should come after the caption. Also wrapfigure will reserve the space arround your figure and make it fit in the available space, so the additional [width=.2\textwidth]
is not necessary but that was not creating your problem.
Here is a working example
---
title : "test title"
author: "Some Guy"
date: "June 30, 2017"
output: pdf_document
urlcolor: blue
header-includes:
- \usepackage{wrapfig}
---
```{r echo = FALSE}
url <- "https://cdn.pixabay.com/photo/2017/11/15/20/27/diamonds-2952447_960_720.png"
curl::curl_download(url, "image.png")
```
## Introduction
\begin{wrapfigure}{R}{.25\textwidth}
\begin{center}
\includegraphics[width=.2\textwidth]{image.png}
\caption{Diamonds}
\end{center}
\end{wrapfigure}
Words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words.
### Areas of Interest
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words .
### Analytic Technique
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
### Benefits of Analysis
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
words words words words words words words words words words words words words
Which produces :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With