我正在尝试使用rmarkdown通过LaTeX生成PDF。我正在尝试使用带有RMarkdown文档的LaTeX命令将图片插入PDF。我正在使用正确插入图形的LaTeX命令wrapfigure
,但随后将当前部分后面的文本强制转换为更窄的列,如here所示。
我的PDF看起来像:
文字文字[图片]
文字文字
文字文字
我想:
文字文字[图片]
文本文本文本文本
文本文本文本文本
该问题的解决方案涉及使用完整的LaTeX文档,但我需要在我的课程中使用RMarkdown,因此该解决方案对我不起作用。如何使用RMarkdown获得我想要的正确的全行格式?
代码示例:
---
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
更新: 一位朋友建议我需要用{R}结束LaTeX代码部分。这使得保证金错误停止发生,但它将文本“{R}”添加到我的PDF中。
代码现在看起来像:
\begin{wrapfigure}{R}{.25\textwidth}
\begin{center}
\includegraphics[width=.2\textwidth]{Dave_roberts.png}
\end{center}
\caption{Dave Roberts}
\end{wrapfigure}{R}
因此,结束LaTeX调用似乎是一个问题。有没有人知道如何结束LaTeX调用但不向PDF添加文本?
答案 0 :(得分:0)
你的问题来自你的\end{center}
论证的位置,该位置应该在标题之后。另外,wrapfigure将保留图形周围的空间并使其适合可用空间,因此不需要额外的[width=.2\textwidth]
,但这不会产生问题。
这是一个工作示例
---
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