Add Blank Line to Word Output RMarkdown
An answer was provided to me by chinsoon12. Here is the code I used to get the desired output. I do find it a little bit strange that I needed to write \newline \newline (rather than putting it only once). It was also not possible to add \newline at the end of a line of code and get the same effect. You need to have a line breaks in your .rmd file in order for it to work (at least from what I attempted).
---
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^
\newline
Affiliations: ^1^University of Michigan
\newline \newline
*Presenting author information*
Name: John H. Curry
Email: [email protected]
Affiliation details: Kinesiology, University of Somewhere, Ottawa, Canada
\newline \newline
*Coauthor #2*
Name: Kathy S. James
Email: [email protected]
Affiliation details: Kinesiology, University of Somewhere, Ottawa, Canada
\newline \newline
*Coauthor #3*
Name: Patrick S. Curry
Email: [email protected]
Affiliation details: Kinesiology, University of Somewhere, Ottawa, Canada
\newline \newline
## Introduction
Here is where I write my introduction....
\newline \newline
## Methods
Here is where I write my methods
\newline \newline
## Results
Here is where I write my results...
\newline \newline
## Discussion
Here is where I write my discussion
\newline \newline
I upvoted the answer 2 years ago, but now \newline
doesn't work for me. However, <br>
works. Make sure you have empty space above and below <br>
. Works for charts and code snippet output too.
---
title: "Word/knitr linefeed test"
author: "E Krantz"
date: "7/28/2020"
output: word_document
---
Here are results with no assisted new line.
How to new line in knitr with MSWord? Test newline:
\newline \newline
That doesn't work. Test br:
<br>
That does not work. Test br with linebreak after:
<br>
No changes. Test br with linebreak before:
<br>
This puts a space before this sentence. Test br with break before and after.
<br>
That works! Double br:
<br>
<br>
Same as single br. How about double br with a line break between each?
<br>
<br>
That works!
Here are the results:
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: [email protected]
Affiliation details: Kinesiology, University of Somewhere, Ottawa, Canada
\newline
*Coauthor #2*
Name: Kathy S. James
Email: [email protected]
Affiliation details: Kinesiology, University of Somewhere, Ottawa, Canada
\newline
*Coauthor #3*
Name: Patrick S. Curry
Email: [email protected]
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
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.