forked from sebastiansauer/yart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
yart-via-template.Rmd
234 lines (134 loc) · 8.07 KB
/
yart-via-template.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
---
date: '`r format(Sys.Date(), "%d\\. %m\\. %Y")`' # today
#logo: /Users/sebastiansaueruser/Pictures/Logos/logo.jpg
#bibliography:
# - /Users/sebastiansaueruser/Literatur/refmgt/library-zotero.bib
#biblio-style: "apa"
# csl: "/Users/sebastiansaueruser/Literatur/refmgt/apa.csl"
# fontfamily: lmodern
fontsize: 11pt
# geometry: margin=1.3in
classoption:
- a4paper
- oneside
#- more options here, see rmarkdown documentation
lang: de-De
numbersections: yes
csquotes: TRUE
#toc_depth: 2
title: "Vignette for package yart"
subtitle: "NOT via an r package, but as a pandoc-template"
author: "Sebastian Sauer"
course: 'Seminar: Solutions to All and Nothing'
address: My Road 1, 12345 Somesmalltown
field: Sophism
#logo: examples/logo.png # insert path to your logo
referee: 'Referee: Prof. Dr. I. Weiss-Ois'
ID: 'My Immatriculation ID: 12345679'
abstract: |
Yart provides an RMarkdown template for rendering TeX based PDFs. It provides a format suitable for academic settings. The typical RMarkdown variables may be used. In additiion, some variabels useful for academic reports have been added such as name of referee, due date, course title, field of study, addres of author, and logo, and a few more maybe. In addition, paper format (eg., paper size, margins) may be adjusted; the babel language set of Latex is supported. Those variables are defined in the yaml header of the yart document. Adjust those variables to your need. Note that citations, figure/ table referencing is possible due to the underlying pandoc magic. This template is not much more than setting some of the variables provided by rmarkdown (pandoc, knitr, latex, and more), credit is due to the original authors. Please reade the rmarkdown documentation for detailled information on how to use rmarkdown and how to change settings.
output:
pdf_document:
template: template-yart.tex
latex_engine: xelatex
toc: no
toc_depth: 2
citation_package: biblatex
# pandoc_args:
# - --filter
# - /Users/sebastiansaueruser/exec/typography.py/typography.py
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# My Section Header 1
Please see the documentation of [RMarkdown](http://rmarkdown.rstudio.com/) for more details on how to write RMarkdown documents.
Download a testlogo from here: <https://raw.githubusercontent.com/sebastiansauer/yart/master/docs/logo.png> and uncomment the respective line in the header.
For finetuning of design options, please check the tex template. There you will find some variables such as `$classoption$`. Those variables may be addressed in the yaml header of the yart file.
## My Section Header 2
"Lorem ipsum" dolor sit amet, consectetur adipiscing elit. Proin mollis
dolor vitae tristique eleifend. Quisque non ipsum sit amet velit
malesuada consectetur. Praesent vel facilisis leo. Sed facilisis
varius orci, ut aliquam lorem malesuada in. Morbi nec purus at nisi
fringilla varius non ut dui. Pellentesque bibendum sapien velit. Nulla
purus justo, congue eget enim a, elementum sollicitudin eros. Cras
porta augue ligula, vel adipiscing odio ullamcorper eu. In tincidunt
nisi sit amet tincidunt tincidunt. Maecenas elementum neque eget dolor
[egestas fringilla](http://example.com):
> Nullam eget dapibus quam, sit amet sagittis magna. Nam tincidunt,
> orci ac imperdiet ultricies, neque metus ultrices quam, id gravida
> augue lacus ac leo.
Vestibulum id sodales lectus, sed scelerisque quam. Nullam auctor mi
et feugiat commodo. Duis interdum imperdiet nulla, vitae bibendum eros
placerat non. Cras ornare, risus in faucibus malesuada, libero sem
fringilla quam, ut luctus enim sapien eget dolor.
- Aufzählungen (nummeriert oder nicht) sind möglich.
- Sonderzeichen werden unterstützt: äüß.
- \LaTeX wird unterstützt.
- Und damit auch "schöne" Formeln: $e^{ln(e)}=e$ (stimmt das?).
- Ein Überblick zur **Markdown-Syntax** findet sich [hier](http://pandoc.org/README.html#pandocs-markdown).
- Ein paar Gimmicks: H~2~O, This ~~is deleted text.~~, feas*ible*, not feas*able*, lang---ganz lang.
- Use `\ts` as a shorthand for `\thinspace` to get "z.\ts B." instead of "z. B." (thin space between the two letters)
- Footnotes are supported[^1].
- Zitationen sind möglich, im beliebigen Format, z.B. APA6. Das Format wird über die Variable `cls` definiert (im Kopfteil oben). Die entsprechende Datei muss im gleichen Ordner liegen wie diese Rmd-Datei. Die Datei mit den bibliographischen Informationen wird über die Variable `bibliography` angegeben. Auch diese Datei muss sich im gleichen Ordner befinden wie diese Rmd-Datei.
- Besonders schön ist es, dass man [R](https://cran.r-project.org) direkt einbinden kann über [knitr](http://yihui.name/knitr/). [Hier](http://galahad.well.ox.ac.uk/repro/) findet sich eine gute Anleitung.
[^1]: Fußnoten sind bei Pandoc eine Art von Links.
We report how we determined our sample size, all data exclusions (if any), all manipulations, and all measures in the study. <!-- 21-word solution (Simmons, Nelson & Simonsohn, 2012; retrieved from http://ssrn.com/abstract=2160588) -->
# R-Code
So bindet man R-Code ein:
```{r}
x <- c(1,2,3)
mean(x)
```
# Citation
Put the file with the references in the same folder as the rmd-file. Uncomment/insert a line in the yaml header such as `bibliography: bib.bib`, where `bib.bib` is the name of your bib-file. Similarly, if you want to format the citation in a certain style, put the respective csl-file in the same folder as this document and uncomment/insert this line in the yaml header: `csl: apa6.csl`, where `apa6.csl` is the style file.
Use this format for citation: `[\@bibtexkey]`. Put all the bibliography data in one bibliography file.
Don't forget to cite software and data. R and R packages can be cited in the following way:
```{r eval = FALSE}
citation()
citation("rmarkdown")
```
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin mollis
dolor vitae tristique eleifend. Quisque non ipsum sit amet velit
malesuada consectetur.
# Tabellen
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.
So erstellt man "von Hand" eine Tabelle in Markdown:
---
```
Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
Table: Table caption
```
---
Das ist das Ergebnis:
Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
Table: Table caption
There are comfortable and powerful R packages available for rendering markdown tables such as Huxtable, or xtable, and other.
Table with R package `xtable`; note that this package needs to be installed to run this example.
```{r xtable-example, eval = FALSE}
data(mtcars)
library(xtable)
print.xtable(
xtable(head(daten),
label="tab:daten",
caption="Datenstruktur für eine within-Analyse"),
comment=FALSE)
```
# Figures
Use knit to insert images. Figures can be referenced, too.
```{r fig1, echo = TRUE, eval = FALSE, fig.cap = "Example of a figure", out.width = "50%"}
knitr::include_graphics("/docs/picture2.png")
```
# References
[If some literature is cited, it appears here]
<!-- These lines ensure references are set with hanging indents in PDF documents -->
\setlength{\parindent}{-0.5in}
\setlength{\leftskip}{0.5in}