forked from rstudio/rmarkdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_rtf_document_format.Rmd
110 lines (77 loc) · 3.15 KB
/
_rtf_document_format.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
title: "RTF Documents"
output:
html_document:
toc: true
---
## Overview
To create an RTF document from R Markdown you specify the `rtf_document` output format in the front-matter of your document:
---
title: "Habits"
author: John Doe
date: March 22, 2005
output: rtf_document
---
## Table of Contents
You can add a table of contents using the `toc` option and specify the depth of headers that it applies to using the `toc_depth` option. For example:
---
title: "Habits"
output:
rtf_document:
toc: true
toc_depth: 2
---
If the table of contents depth isn't explicitly specified then it defaults to 3 (meaning that all level 1, 2, and 3 headers will be included in the table of contents).
## Figure Options
The `fig_width` and `fig_height` options can be used to control the default figure width and height (5x4 is used if not values are specified). For example:
---
title: "Habits"
output:
rtf_document:
fig_width: 5
fig_height: 5
---
## Keeping Markdown
When knitr processes an R Markdown input file it creates a markdown (md) file which is subsequently transformed into an RTF document by pandoc. If you want to keep a copy of the markdown file after rendering you can do so using the `keep_md` option:
---
title: "Habits"
output:
rtf_document:
keep_md: true
---
## Markdown Extensions
By default R Markdown is defined as all pandoc markdown extensions with the following tweaks for backward compatibility with the markdown package:
```
+autolink_bare_uris
+ascii_identifier
+tex_math_single_backslash
```
You can enable or disable markdown extensions using the `md_extensions` option (you preface an option with `-` to disable and `+` to enable it). For example:
---
title: "Habits"
output:
rtf_document:
md_extensions: -autolink_bare_uris+hard_line_breaks
---
The above would disable the `autolink_bare_uris` extension and enable the `hard_line_breaks` extension.
For more on available markdown extensions see the [pandoc markdown specification](http://pandoc.org/README.html#pandocs-markdown).
## Pandoc Arguments
If there are pandoc features you want to use that lack equivalents in the YAML options described above you can still use them by passing custom `pandoc_args`. For example:
---
title: "Habits"
output:
rtf_document:
pandoc_args: [
"--csl", "/var/csl/acs-nano.csl"
]
---
Documentation on all available pandoc arguments can be found in the [pandoc user guide](http://johnmacfarlane.net/pandoc/README.html#options).
## Shared Options
If you want to specify a set of default options to be shared by multiple documents within a directory you can include a file named `_output.yaml` within the directory. Note that no YAML delimiters or enclosing output object are used in this file. For example:
**\_output.yaml**
```yaml
rtf_document:
fig_width: 5
fig_height: 5
```
All documents located in the same directory as `_output.yaml` will inherit its options. Options defined explicitly within documents will override those specified in the shared options file.