# Rmarkdown to Word
###### tags: `R`
- [name=TSAI Jie-Wen]
- [time=Mon, Feb 28, 2022 4:55 AM]
{%hackmd @nccudocs/medium-theme %}
## 1. Using Rmarkdown for academic writing
- Convert `.Rmd` to `.docx`
There are 3 important setting:
1. `bibliography`: You have to create a `.bib` file in the same folder of the `.Rmd` file. It is a smart way to control and manage ur biblio files.
2. `csl`: Using apa 7 style (apa.csl) from here https://github.com/citation-style-language/styles
3. `reference_docx`:
## 2. YAML Usage (Rmarkdown)
I suggest use short version (only for word).
```{yaml}
---
title: "Test 0208"
author: "JW"
date: \today
bibliography: test0208.bib
csl: apa7.csl
output:
word_document:
reference_docx: Style-MC.docx
---
```
The long ver. is below.
```{yaml}
---
title: "Test 0208"
author: "JW"
date: \today
geometry: margin=1in
papersize: a4
fontsize: 12pt
#indent: true
linestretch: 1.5
CJKmainfont: Songti TC #DFKai-SB
mainfont: CMU Serif #Calibri
bibliography: test0208.bib
csl: apa7.csl
output:
word_document:
reference_docx: Style-MC.docx
pdf_document:
latex_engine: xelatex
fig_caption: yes
number_sections: yes
df_print: kable
html_document:
df_print: paged
---
```