Skip to content

Commit 248a05b

Browse files
committed
Merge pull request #12 from sjmgarnier/master
Added template for PLoS journals (LaTeX).
2 parents bae4117 + 3f246b1 commit 248a05b

File tree

7 files changed

+1715
-0
lines changed

7 files changed

+1715
-0
lines changed

R/plos_article.R

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#' @export
2+
plos_article <- function() {
3+
template <- find_resource("plos_article", "template.tex")
4+
5+
base <- rmarkdown::pdf_document(template = template, keep_tex = TRUE)
6+
7+
# Mostly copied from knitr::render_sweave
8+
base$knitr$opts_knit$out.format <- "sweave"
9+
10+
base$knitr$opts_chunk$prompt <- TRUE
11+
base$knitr$opts_chunk$comment <- NA
12+
base$knitr$opts_chunk$highlight <- FALSE
13+
14+
hook_chunk <- function(x, options) {
15+
if (knitr:::output_asis(x, options)) return(x)
16+
paste0('\\begin{CodeChunk}\n', x, '\\end{CodeChunk}')
17+
}
18+
hook_input <- function(x, options) {
19+
paste0(c('\\begin{CodeInput}', x, '\\end{CodeInput}', ''),
20+
collapse = '\n')
21+
}
22+
hook_output <- function(x, options) {
23+
paste0('\\begin{CodeOutput}\n', x, '\\end{CodeOutput}\n')
24+
}
25+
26+
base$knitr$knit_hooks$chunk <- hook_chunk
27+
base$knitr$knit_hooks$source <- hook_input
28+
base$knitr$knit_hooks$output <- hook_output
29+
base$knitr$knit_hooks$message <- hook_output
30+
base$knitr$knit_hooks$warning <- hook_output
31+
base$knitr$knit_hooks$plot <- knitr:::hook_plot_tex
32+
33+
base
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
% Template for PLoS
2+
3+
\documentclass[10pt]{article}
4+
5+
% amsmath package, useful for mathematical formulas
6+
\usepackage{amsmath}
7+
% amssymb package, useful for mathematical symbols
8+
\usepackage{amssymb}
9+
10+
% hyperref package, useful for hyperlinks
11+
\usepackage{hyperref}
12+
13+
% graphicx package, useful for including eps and pdf graphics
14+
% include graphics with the command \includegraphics
15+
\usepackage{graphicx}
16+
17+
% Sweave(-like)
18+
\usepackage{fancyvrb}
19+
\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl}
20+
\DefineVerbatimEnvironment{Soutput}{Verbatim}{}
21+
\DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl}
22+
\newenvironment{Schunk}{}{}
23+
\DefineVerbatimEnvironment{Code}{Verbatim}{}
24+
\DefineVerbatimEnvironment{CodeInput}{Verbatim}{fontshape=sl}
25+
\DefineVerbatimEnvironment{CodeOutput}{Verbatim}{}
26+
\newenvironment{CodeChunk}{}{}
27+
28+
% cite package, to clean up citations in the main text. Do not remove.
29+
\usepackage{cite}
30+
31+
\usepackage{color}
32+
33+
% Use doublespacing - comment out for single spacing
34+
%\usepackage{setspace}
35+
%\doublespacing
36+
37+
38+
% Text layout
39+
\topmargin 0.0cm
40+
\oddsidemargin 0.5cm
41+
\evensidemargin 0.5cm
42+
\textwidth 16cm
43+
\textheight 21cm
44+
45+
% Bold the 'Figure #' in the caption and separate it with a period
46+
% Captions will be left justified
47+
\usepackage[labelfont=bf,labelsep=period,justification=raggedright]{caption}
48+
49+
% Use the PLoS provided bibtex style
50+
\bibliographystyle{plos}
51+
52+
% Remove brackets from numbering in List of References
53+
\makeatletter
54+
\renewcommand{\@biblabel}[1]{\quad#1.}
55+
\makeatother
56+
57+
58+
% Leave date blank
59+
\date{}
60+
61+
\pagestyle{myheadings}
62+
%% ** EDIT HERE **
63+
64+
65+
%% ** EDIT HERE **
66+
%% PLEASE INCLUDE ALL MACROS BELOW
67+
68+
%% END MACROS SECTION
69+
70+
\begin{document}
71+
72+
% Title must be 150 characters or less
73+
\begin{flushleft}
74+
{\Large
75+
\textbf{$title$}
76+
}
77+
% Insert Author names, affiliations and corresponding author email.
78+
\\
79+
$for(author)$
80+
$author.name$\textsuperscript{$author.affiliation$$if(author.email)$*$endif$}$sep$,
81+
$endfor$
82+
\\
83+
$for(affiliation)$
84+
\bf{$affiliation.id$} $if(affiliation.department)$$affiliation.department$, $endif$$if(affiliation.institution)$$affiliation.institution$, $endif$ $if(affiliation.city)$$affiliation.city$, $endif$ $if(affiliation.state)$$affiliation.state$, $endif$ $if(affiliation.country)$$affiliation.country$$endif$
85+
\\
86+
$endfor$
87+
88+
\textasteriskcentered{} E-mail: $for(author)$
89+
$if(author.email)$$author.email$$endif$
90+
$endfor$
91+
92+
\end{flushleft}
93+
94+
$body$
95+
96+
\end{document}
97+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@article{Garnier2007,
2+
abstract = {The roots of swarm intelligence are deeply embedded in the biological study of self-organized behaviors in social insects. From the routing of traffic in telecommunication networks to the design of control algorithms for groups of autonomous robots, the collective behaviors of these animals have inspired many of the foundational works in this emerging research field. For the first issue of this journal dedicated to swarm intelligence, we review the main biological principles that underlie the organization of insects’ colonies. We begin with some reminders about the decentralized nature of such systems and we describe the un- derlying mechanisms of complex collective behaviors of social insects, from the concept of stigmergy to the theory of self-organization in biological systems.We emphasize in partic- ular the role of interactions and the importance of bifurcations that appear in the collective output of the colony when some of the system’s parameters change. We then propose to categorize the collective behaviors displayed by insect colonies according to four functions that emerge at the level of the colony and that organize its global behavior. Finally, we ad- dress the role of modulations of individual behaviors by disturbances (either environmental or internal to the colony) in the overall flexibility of insect colonies. We conclude that fu- ture studies about self-organized biological behaviors should investigate such modulations to better understand how insect colonies adapt to uncertain worlds.},
3+
author = {Garnier, Simon and Gautrais, Jacques and Theraulaz, Guy},
4+
doi = {10.1007/s11721-007-0004-y},
5+
file = {:Users/simongarnier/Work/bibliography/Mendeley/Swarm Intelligence/2007/Garnier, Gautrais, Theraulaz - 2007.pdf:pdf},
6+
issn = {1935-3812},
7+
journal = {Swarm Intelligence},
8+
keywords = {self organization collective,self-organization collective,social insects,stigmergy,swarm intelligence},
9+
mendeley-tags = {swarm intelligence},
10+
month = jul,
11+
number = {1},
12+
pages = {3--31},
13+
title = {{The biological principles of swarm intelligence}},
14+
url = {http://www.springerlink.com/index/10.1007/s11721-007-0004-y},
15+
volume = {1},
16+
year = {2007}
17+
}

0 commit comments

Comments
 (0)