Skip to content

Commit 717c4d9

Browse files
authored
Merge pull request #127 from zkamvar/add-peerj
PeerJ format
2 parents b3b2a59 + 35e51a7 commit 717c4d9

File tree

10 files changed

+563
-0
lines changed

10 files changed

+563
-0
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export(ctex_template)
1010
export(elsevier_article)
1111
export(ieee_article)
1212
export(jss_article)
13+
export(peerj_article)
1314
export(plos_article)
1415
export(pnas_article)
1516
export(rjournal_article)

R/peerj_article.R

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#' PeerJ journal format.
2+
#'
3+
#' Format for creating submissions to The PeerJ.
4+
#'
5+
#' @inheritParams rmarkdown::pdf_document
6+
#' @param ... Additional arguments to \code{rmarkdown::pdf_document}
7+
#' @param base_format The function to use for the base format of the article.
8+
#' By default, this is \code{rmarkdown::pdf_document}, but to use pandoc's
9+
#' cross-referencing feature, this can be set to \code{bookdown::pdf_document2}
10+
#'
11+
#'
12+
#' @return R Markdown output format to pass to
13+
#' \code{\link[rmarkdown:render]{render}}
14+
#'
15+
#' @examples
16+
#'
17+
#' \dontrun{
18+
#' library(rmarkdown)
19+
#' draft("MyArticle.Rmd", template = "peerj_article", package = "rticles")
20+
#' }
21+
#'
22+
#' @export
23+
peerj_article <- function(..., keep_tex = TRUE, citation_package = "natbib",
24+
base_format = rmarkdown::pdf_document) {
25+
if (inherits(base_format, "character")){
26+
FMT <- eval(parse(text = base_format))
27+
} else {
28+
FMT <- match.fun(base_format)
29+
}
30+
out <- FMT(...,
31+
citation_package = citation_package,
32+
keep_tex = keep_tex,
33+
template = find_resource("peerj_article", "template.tex"))
34+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
%% Submissions for peer-review must enable line-numbering
2+
%% using the lineno option in the \documentclass command.
3+
%%
4+
%% Preprints and camera-ready submissions do not need
5+
%% line numbers, and should have this option removed.
6+
%%
7+
%% Please note that the line numbering option requires
8+
%% version 1.1 or newer of the wlpeerj.cls file, and
9+
%% the corresponding author info requires v1.2
10+
11+
$if(preprint)$
12+
\documentclass[fleqn,10pt]{wlpeerj} % for preprint submissions
13+
$else$
14+
\documentclass[fleqn,10pt,lineno]{wlpeerj} % for journal submissions
15+
$endif$
16+
17+
% ZNK -- Adding headers for pandoc
18+
19+
\setlength{\emergencystretch}{3em}
20+
\providecommand{\tightlist}{
21+
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
22+
\usepackage{lipsum}
23+
\usepackage[unicode=true]{hyperref}
24+
\usepackage{longtable}
25+
26+
27+
28+
$for(header-includes)$
29+
$header-includes$
30+
$endfor$
31+
32+
\title{$title$}
33+
34+
$for(author)$
35+
\author[$author.affiliation$]{$author.name$}
36+
37+
$if(author.corresponding)$
38+
\corrauthor[$author.affiliation$]{$author.name$}{$author.email$}
39+
$endif$
40+
$endfor$
41+
42+
$for(affiliation)$
43+
\affil[$affiliation.code$]{$affiliation.address$}
44+
$endfor$
45+
46+
47+
%
48+
% \author[1]{First Author}
49+
% \author[2]{Second Author}
50+
% \affil[1]{Address of first author}
51+
% \affil[2]{Address of second author}
52+
% \corrauthor[1]{First Author}{f.author@email.com}
53+
54+
% $if(keywords)$
55+
% \keywords{$for(keywords)$$keywords$$sep$$endfor$}
56+
% $endif$
57+
58+
\begin{abstract}
59+
$abstract$
60+
% Dummy abstract text. Dummy abstract text. Dummy abstract text. Dummy abstract text. Dummy abstract text. Dummy abstract text. Dummy abstract text. Dummy abstract text. Dummy abstract text. Dummy abstract text. Dummy abstract text.
61+
\end{abstract}
62+
63+
\begin{document}
64+
65+
\flushbottom
66+
\maketitle
67+
\thispagestyle{empty}
68+
69+
$body$
70+
71+
$for(include-after)$
72+
$include-after$
73+
$endfor$
74+
75+
\bibliography{$bibliography$}
76+
77+
78+
\end{document}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@ARTICLE{Figueredo:2009dg,
2+
author = {Figueredo, A.~J. and Wolf, P. S.~A.},
3+
title = {Assortative pairing and life history strategy - a cross-cultural study.},
4+
journal = {Human Nature},
5+
volume = {20},
6+
pages = {317-330},
7+
year = {2009}
8+
}
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
---
2+
title: Template for preparing your research report submission to PeerJ using RMarkdown
3+
preprint: false
4+
author:
5+
- name: Barbara McClintock
6+
affiliation: 1
7+
corresponding: true
8+
email: mcclintockb@cshl.edu
9+
- name: Charles E. Darwin
10+
affiliation: 2
11+
affiliation:
12+
- code: 1
13+
address: Cold Spring Harbor Laboratory, One Bungtown Road Cold Spring Harbor, NY 11724
14+
- code: 2
15+
address: Down House, Luxted Rd, Downe, Orpington BR6 7JT, UK
16+
abstract: >
17+
The abstract of the article.
18+
It can also be on *multiple* lines.
19+
header-includes: >
20+
\usepackage{lipsum}
21+
bibliography: sample.bib
22+
output:
23+
rticles::peerj_article:
24+
base_format: rmarkdown::pdf_document # bookdown::pdf_document2 # for using \@ref()
25+
---
26+
27+
28+
# Introduction {-}
29+
30+
Your introduction goes here! Some examples of commonly used commands and features are listed below, to help you get started.
31+
32+
If you have a question, please use the help menu in the top right of the screen to get in touch. When your article or pre-print is complete, use the "Submit to PeerJ" button in the topbar to send your files to PeerJ.
33+
34+
## About PeerJ {-}
35+
36+
PeerJ is an award-winning open access publisher covering the biological and medical sciences. PeerJ provides authors with three publication venues: *PeerJ* and *PeerJ Computer Science* (peer-reviewed academic journals) and *PeerJ PrePrints* (a 'pre-print server'). See https://peerj.com/about/publications/ for more information.
37+
38+
The PeerJ model allows an author to publish articles in their peer-reviewed journal via the purchase of a lifetime Publication Plan. Prices start from just \$99 (a one-off payment) which entitles an author to the lifetime ability to publish 1 article per year for free. Publication in PeerJ PrePrints is entirely free.
39+
40+
# Some \LaTeX{} Examples {-}
41+
42+
Use section and subsection commands to organize your document. \LaTeX{} handles all the formatting and numbering automatically. Use ref and label commands for cross-references.
43+
44+
## Figures and Tables {-}
45+
46+
Use the table and tabular commands for basic tables --- see Table \@ref(tab:simtab1), for example. You can upload a figure (JPEG, PNG or PDF) using the project menu. To include it in your document, use the includegraphics command as in the code for Figure \@ref(fig:view) below.
47+
48+
Standard \LaTeX references will work as well (e.g. Fig. \ref{fig:view}).
49+
50+
<!--
51+
\begin{figure}[ht]
52+
\centering
53+
\includegraphics[width=\linewidth]{view}
54+
\caption{An example image.}
55+
\label{fig:view}
56+
\end{figure}
57+
-->
58+
59+
```{r view, out.width = "100%", fig.cap = "An example image.", echo = FALSE}
60+
knitr::include_graphics("view.pdf")
61+
```
62+
63+
<!--
64+
\begin{table}[ht]
65+
\centering
66+
\begin{tabular}{l|r}
67+
Item & Quantity \\\hline
68+
Widgets & 42 \\
69+
Gadgets & 13
70+
\end{tabular}
71+
\caption{\label{tab:widgets}An example table.}
72+
\end{table}
73+
-->
74+
75+
Item Quantity
76+
------- ---------
77+
Widgets 42
78+
Gadgets 13
79+
80+
Table: (\#tab:widgets) An Example Table.
81+
82+
## Citations {-}
83+
84+
LaTeX formats citations and references automatically using the bibliography records in your .bib file, which you can edit via the project menu. Use the cite command for an inline citation, like @Figueredo:2009dg, and the citep command for a citation in parentheses [@Figueredo:2009dg].
85+
86+
## Mathematics {-}
87+
88+
\LaTeX{} is great at typesetting mathematics. Let $X_1, X_2, \ldots, X_n$ be a sequence of independent and identically distributed random variables with $\text{E}[X_i] = \mu$ and $\text{Var}[X_i] = \sigma^2 < \infty$, and let
89+
$$S_n = \frac{X_1 + X_2 + \cdots + X_n}{n}
90+
= \frac{1}{n}\sum_{i}^{n} X_i$$
91+
denote their mean. Then as $n$ approaches infinity, the random variables $\sqrt{n}(S_n - \mu)$ converge in distribution to a normal $\mathcal{N}(0, \sigma^2)$.
92+
93+
## Lists {-}
94+
95+
You can make lists with automatic numbering \dots
96+
97+
98+
1. Like this,
99+
1. and like this.
100+
101+
or bullet points...
102+
103+
- Like this,
104+
- and like this.
105+
106+
or with descriptions...
107+
108+
- **Word** Definition
109+
- **Concept** Explanation
110+
- **Idea** Text
111+
112+
113+
We hope you find write\LaTeX\ useful for your PeerJ submission, and please let us know if you have any feedback. Further examples with dummy text are included in the following pages.
114+
115+
# Methods {-}
116+
117+
\lipsum[4]
118+
119+
\begin{equation}
120+
\cos^3 \theta =\frac{1}{4}\cos\theta+\frac{3}{4}\cos 3\theta
121+
\label{eq:refname2}
122+
\end{equation}
123+
124+
\lipsum[5]
125+
126+
## Subsection {-}
127+
128+
\lipsum[6]
129+
130+
\paragraph{Paragraph} \lipsum[7]
131+
\paragraph{Paragraph} \lipsum[8]
132+
133+
## Subsection {-}
134+
135+
\lipsum[9]
136+
137+
<!-- \begin{figure}[ht]\centering -->
138+
<!-- \includegraphics[width=\linewidth]{results} -->
139+
<!-- \caption{In-text Picture} -->
140+
<!-- \label{fig:results} -->
141+
<!-- \end{figure} -->
142+
143+
```{r results, fig.width = 5, fig.height = 4, out.width = "100%", fig.cap = "In-text Picture", echo = FALSE}
144+
# knitr::include_graphics("figure/simulations/rd_sexrate.pdf")
145+
time = seq(1.5, 8, 0.1)
146+
plot(time, sin(time), type = "l", xlab = "time [s]", ylab = "amplitude [m]",
147+
cex.main = 2, col = "blue", lwd = 3, font = 2, font.main = 2)
148+
```
149+
150+
151+
Reference to Figure \@ref(fig:results).
152+
153+
# Results and Discussion {-}
154+
155+
\lipsum[10]
156+
157+
## Subsection {-}
158+
159+
\lipsum[11]
160+
161+
### Subsubsection {-}
162+
163+
\lipsum[12]
164+
165+
### Subsubsection {-}
166+
167+
\lipsum[14]
168+
169+
## Subsection {-}
170+
171+
\lipsum[15-20]
172+
173+
# Acknowledgments {-}
174+
175+
So long and thanks for all the fish.
176+
177+
# References
Loading

0 commit comments

Comments
 (0)