将空白行添加到Word输出RMarkdown [英] Add Blank Line to Word Output RMarkdown
问题描述
美好的一天.
我正在尝试使用rmarkdown文件创建会议摘要提交,该文件可以导出到Word文档.我正在尝试找到一种在输出的Word文档中插入空白行的方法.我发现可以通过在markdown文件的末尾添加两个空格来插入换行符,但是,当您只需要空白行时,此技巧不起作用.下面是示例代码
I am trying to create a conference abstract submission using a rmarkdown file which exports to a word document. I am trying to find a way to insert a blank line in the outputted word document. I have found that a line break can be inserted by adding two blank spaces at the end of a markdown file, however, this trick does not work when you simply want a blank line. Below is example code
---
title: "HERE IS THE TITLE OF MY ABSTRACT"
output:
word_document:
reference_docx: draft-styles.docx
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r, include=FALSE, cache=FALSE, echo=FALSE}
library(rmarkdown)
```
Authors: John H. Curry^1^, Kathy S. James^1^, Patrick S. Curry^1^
Affiliations: ^1^University of Somewhere
*Presenting author information*
Name: John H. Curry
Email: curry@umed.edu
Affiliation details: Kinesiology, University of Somewhere, Ottawa, Canada
*Coauthor #2*
Name: Kathy S. James
Email: james@umed.edu
Affiliation details: Kinesiology, University of Somewhere, Ottawa, Canada
*Coauthor #3*
Name: Patrick S. Curry
Email: curry2@umed.edu
Affiliation details: Kinesiology, University of Somewhere, Ottawa, Canada
## Introduction
Here is where I write my introduction....
## Methods
Here is where I write my methods
## Results
Here is where I write my results...
## Discussion
Here is where I write my discussion
当我编织文档时,可惜的是它有点簇.在下面,我添加了一张带有当前输出的图片(左)和我想要的样子(右).
When I knit the document, sadly its a little clustered. Below I've added a picture with the current output (left) and what I would like it to look like (right).
我已经阅读了所有论坛,但在使用Word文档时,还没有看到解决方案.我将不胜感激.
I have read through forums and I have yet to see a solution for this when using a word document. I would appreciate any suggestions.
谢谢
推荐答案
您可以在Rmd文件中使用\newline
,如下所示:
you can use \newline
in the Rmd file as follows:
---
title: "HERE IS THE TITLE OF MY ABSTRACT"
output:
word_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r, include=FALSE, cache=FALSE, echo=FALSE}
library(rmarkdown)
```
Authors: John H. Curry^1^, Kathy S. James^1^, Patrick S. Curry^1^
Affiliations: ^1^University of Somewhere
\newline
*Presenting author information*
Name: John H. Curry
Email: curry@umed.edu
Affiliation details: Kinesiology, University of Somewhere, Ottawa, Canada
\newline
*Coauthor #2*
Name: Kathy S. James
Email: james@umed.edu
Affiliation details: Kinesiology, University of Somewhere, Ottawa, Canada
\newline
*Coauthor #3*
Name: Patrick S. Curry
Email: curry2@umed.edu
Affiliation details: Kinesiology, University of Somewhere, Ottawa, Canada
\newline
## Introduction
Here is where I write my introduction....
\newline
## Methods
Here is where I write my methods
\newline
## Results
Here is where I write my results...
\newline
## Discussion
Here is where I write my discussion
如果您要问下一个问题,则新页面会稍微难一些.您将需要在标题5中创建一个新样式(例如),该样式会自动在新页面上启动,在Rmd文件中,您将标题5用作新行.网上有很多与此相关的资源.
In case you are going to ask next, newpage is slightly harder. You will need to create a new style in word for Heading 5 (for e.g.) which auto starts on a new page and in your Rmd file you will use heading 5 as your new line. there are quite a number of resources online regarding this though.
这篇关于将空白行添加到Word输出RMarkdown的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!