/
pinp.Rmd
318 lines (222 loc) · 9.44 KB
/
pinp.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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
---
title: pinp is not PNAS
# Use letters for affiliations
author:
- name: Dirk Eddelbuettel
affiliation: a
- name: James Joseph Balamuta
affiliation: b
address:
- code: a
address: Debian and R Projects; Chicago, IL, USA; \url{edd@debian.org}
- code: b
address: Depts of Informatics and Statistics, Univ. of Illinois at Urbana-Champaign; Champaign, IL, USA; \url{balamut2@illinois.edu}
# For footer text TODO(fold into template, allow free form two-authors)
lead_author_surname: Eddelbuettel and Balamuta
# Place DOI URL or CRAN Package URL here
doi: "https://cran.r-project.org/package=pinp"
# Abstract
abstract: |
This short vignette details several of the available options for the `pinp` pdf vignette template.
# Optional: Acknowledgements
acknowledgements: |
We gratefully acknowledge all the help from the
[rticles](https://cran.r-project.org/package=rticles) package
\citep{CRAN:rticles} which not only introduced us to the powerful
[PNAS LaTeX](http://www.pnas.org/site/authors/latex.xhtml) style
class, but also provided useful code templates to study in the
other mode as the fine macros. The [pandoc](http://pandoc.org)
document converter \citep{pandoc} is the much-admired driving force
behind the document manipulation.
# Optional: One or more keywords
#keywords:
# - pdf
# - vignette
# Font size of the document, values of 9pt (default), 10pt, 11pt and 12pt
fontsize: 9pt
# Optional: Force one-column layout, default is two-column
#one_column: true
# Optional: Enables lineo mode, but only if one_column mode is also true
#lineno: true
# Optional: Enable one-sided layout, default is two-sided
#one_sided: true
# Optional: Enable section numbering, default is unnumbered
#numbersections: true
# Optional: Specify the depth of section number, default is 5
#secnumdepth: 5
# Optional: Bibliography
#bibliography: pinp
# Optional: include-after, used here to include rendered bibliography
include-after: |
\begin{thebibliography}{3}
\newcommand{\enquote}[1]{``#1''}
\providecommand{\natexlab}[1]{#1}
\providecommand{\url}[1]{\texttt{#1}}
\providecommand{\urlprefix}{URL }
\expandafter\ifx\csname urlstyle\endcsname\relax
\providecommand{\doi}[1]{doi:\discretionary{}{}{}#1}\else
\providecommand{\doi}{doi:\discretionary{}{}{}\begingroup
\urlstyle{rm}\Url}\fi
\providecommand{\eprint}[2][]{\url{#2}}
\bibitem[{Allaire \emph{et~al.}(2017)Allaire, {R Foundation}, Wickham, {Journal
of Statistical Software}, Xie, Vaidyanathan, {Association for Computing
Machinery}, Boettiger, {Elsevier}, Broman, Mueller, Quast, Pruim, Marwick,
Wickham, Keyes, and Yu}]{CRAN:rticles}
Allaire J, {R Foundation}, Wickham H, {Journal of Statistical Software}, Xie Y,
Vaidyanathan R, {Association for Computing Machinery}, Boettiger C,
{Elsevier}, Broman K, Mueller K, Quast B, Pruim R, Marwick B, Wickham C,
Keyes O, Yu M (2017).
\newblock \emph{rticles: Article Formats for R Markdown}.
\newblock R package version 0.4.1,
\urlprefix\url{https://CRAN.R-project.org/package=rticles}.
\bibitem[{MacFarlane(2017)}]{pandoc}
MacFarlane J (2017).
\newblock \emph{Pandoc: A Universal Document Converter}.
\newblock Version 1.19.2.1, \urlprefix\url{http://pandoc.org}.
\bibitem[{Xie(2017)}]{CRAN:knitr}
Xie Y (2017).
\newblock \emph{knitr: A General-Purpose Package for Dynamic Report Generation
in R}.
\newblock R package version 1.17, \urlprefix\url{https://yihui.name/knitr/}.
\end{thebibliography}
# Optional: Enable a 'Draft' watermark on the document
#watermark: true
# Customize footer, eg by referencing the vignette
footer_contents: "pinp Vignette"
# Produce a pinp document
output: pinp::pinp
# Required: Vignette metadata for inclusion in a package.
vignette: >
%\VignetteIndexEntry{pinp}
%\VignetteKeywords{pinp,vignette}
%\VignettePackage{pinp}
%\VignetteEngine{knitr::rmarkdown}
---
# Introduction
The *pinp is not PNAS* template extends and reworks the
[pnas_article](https://github.com/rstudio/rticles/tree/master/inst/rmarkdown/templates/pnas_article)
template from the wonderful
[rticles](https://cran.r-project.org/package=rticles) package. This
vignette lists the available options.
# YAML Content
## `author`
Fields `name` and `affiliation` must be given. The latter can be a
single-letter index referring to the address field.
## `address`
Fields `code` (referring to the index from `affiliation`) and
`address`. The latter is free-form and may include `\url{}` and other
LaTeX macros.
## `lead_author_surnames`
A free-form field usable for a free-form _et al_ use, or a simple text
field listing authors.
## `doi`
A free-form URL for a paper doi reference, or a canonical URL for a
software package or repository. These are typeset at actual URL and
resolve their links from the pdf document.
## `abstract`
A short free-form abstract can be used to inform the reader of the
essence of the subsequent document.
## `acknowledgements`
An _optional_ free-form text which will be typset at the very end
right before the references, if any.
## `keywords`
An optional list (entered as a YAML list following `-` marks) which will be typeset as a list of alternatives separated by vertical _pipe_ symbols.
# Options
## `fontsize`
Default it 9pt, also supported are 10pt, 11pt and 12pt which may make
sense in one-column mode.
## `one_column`
An _optional_ override (using value `true`) for the default two-column
layout. Useful for initial stages of a document, as well as for
documents with wide-format tables and figures.
## `lineno`
An _optional_ selection (via value `true`) of line numbers,
selectable only if `one_column: true` is set. Currently typesets
number on both the left and right-ahdn side which seems in error.
## `one_sided`
An _optional_ selection (via value `true`) of one-sided rather than
two-sided output. This should probably alter the footnote but does not
currently do so.
## `numbersections`
An _optional_ selection (via value `true`) for overriding the default
unnumbered section headers. Useful if you need to refer to sections by number.
## `secnumdepth`
An _optional_ selection (via values 1, 2, 3, ...) of section numbering depth,
selectable only if `numbersections: true` is set. Useful if you only want
to number sections and subsections but not subsubsections and so on.
## `bibliography`
A field for an _optional_ selection of a Bibtex input file, extension
can be omitted. Alternative, bibliographic information may also be
included directly as a `thebibliography` environment by including the
content of the generated `bbl` file.
## `watermark`
An _optional_ selection of a 'Draft' watermark drawn across the center
of the page (using value `true`). Note that figures may be plotted
above the watermark.
## `footer_contents`
An character value delimited by quotes for something like _"mypackage
Vignette"_ which will be shown in the footer.
# Code
## Knitr
The [knitr](https://cran.r-project.org/package=pinp) package
\citep{CRAN:knitr} is also available to both typeset code, typically
in R or one of the other supported engines. Knitr segments used three
backticks (just like Pandoc described below) followed by curly brace
sgement listing first the desired engine, and then the selected
display options. Output from the code can also be shown, and a myriad
of options permit many variants.
```{r}
a <- 2 + 2
a
```
Output from such code blocks is also shown in a framed and shaded box.
Figures resulting from these code blocks are automatically inlined:
```{r}
set.seed(42)
par(mar=c(3,3,3,0))
plot(cumsum(rnorm(100)), type='l',
main="Up and and away")
```
## Pandoc
The easiest way to typeset code is to simply open three backticks
followed by the name of one of the _numerous_ built-in pandoc parsers,
_i.e._, \verb|```c| to typeset in the C languags. Pandoc segments will
be highlighted as usual, and per a convention in this template also shown in
framed and slightly shaded box as seen here and above.
```c
int doubleMe(int x) {
return x + x;
}
```
# Environments
## Standard LaTeX
All standard LaTeX environment are directly usable if needed,
including of course all mathematical environments and symbols such as,
say, the greek lettering: $\alpha$, $\beta$, $\gamma$, and so on.
The following is set as usual via the `displaymath` environment:
\begin{displaymath}
a^2 = b^2 + c^2
\end{displaymath}
## figure*
Figure can span two columns (when the default two-column mode is used)
by using a (LaTeX) `\begin{figure*} ... \end{figure*}` environment, .
Figures will then be _floats_ in the LaTeX sense and place at the top
or bottom of the page. An example is given by the skeleton document
of the package. Similarly, `\begin{figure*} ... \end{figure*}` could
be used around a wide table structure.
## widetext
The `\begin{widetext*} ... \end{widetext*}` environment can be used to
break text from two-column mode to one-column mode and back.
# Other Help
## RMarkdown
The [rmarkdown site](http://rmarkdown.rstudio.com/) by RStudio is very
comprehensive and can answer many questions pertaining to Markdown
processing in R using the
[rmarkdown package](https://cran.r-project.org/package=rmarkdown).
## LaTeX
Ultimately this style uses LaTeX to produce the pdf output. The
[tex StackExchange](http://tex.stackexchange.com) can be helpful for
specific LaTeX questions.
<!-- local tweak to the pnasbreak command -->
\renewcommand{\pnasbreak}{\begin{strip}\vskip0pt\end{strip}}
\phantom{xxx} <!-- if this isn't here the next para runs in-->