-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added template for PLoS journals (LaTeX). #12
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#' @export | ||
plos_article <- function() { | ||
template <- find_resource("plos_article", "template.tex") | ||
|
||
base <- rmarkdown::pdf_document(template = template, keep_tex = TRUE) | ||
|
||
# Mostly copied from knitr::render_sweave | ||
base$knitr$opts_knit$out.format <- "sweave" | ||
|
||
base$knitr$opts_chunk$prompt <- TRUE | ||
base$knitr$opts_chunk$comment <- NA | ||
base$knitr$opts_chunk$highlight <- FALSE | ||
|
||
hook_chunk <- function(x, options) { | ||
if (knitr:::output_asis(x, options)) return(x) | ||
paste0('\\begin{CodeChunk}\n', x, '\\end{CodeChunk}') | ||
} | ||
hook_input <- function(x, options) { | ||
paste0(c('\\begin{CodeInput}', x, '\\end{CodeInput}', ''), | ||
collapse = '\n') | ||
} | ||
hook_output <- function(x, options) { | ||
paste0('\\begin{CodeOutput}\n', x, '\\end{CodeOutput}\n') | ||
} | ||
|
||
base$knitr$knit_hooks$chunk <- hook_chunk | ||
base$knitr$knit_hooks$source <- hook_input | ||
base$knitr$knit_hooks$output <- hook_output | ||
base$knitr$knit_hooks$message <- hook_output | ||
base$knitr$knit_hooks$warning <- hook_output | ||
base$knitr$knit_hooks$plot <- knitr:::hook_plot_tex | ||
|
||
base | ||
} |
97 changes: 97 additions & 0 deletions
97
inst/rmarkdown/templates/plos_article/resources/template.tex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
% Template for PLoS | ||
|
||
\documentclass[10pt]{article} | ||
|
||
% amsmath package, useful for mathematical formulas | ||
\usepackage{amsmath} | ||
% amssymb package, useful for mathematical symbols | ||
\usepackage{amssymb} | ||
|
||
% hyperref package, useful for hyperlinks | ||
\usepackage{hyperref} | ||
|
||
% graphicx package, useful for including eps and pdf graphics | ||
% include graphics with the command \includegraphics | ||
\usepackage{graphicx} | ||
|
||
% Sweave(-like) | ||
\usepackage{fancyvrb} | ||
\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl} | ||
\DefineVerbatimEnvironment{Soutput}{Verbatim}{} | ||
\DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl} | ||
\newenvironment{Schunk}{}{} | ||
\DefineVerbatimEnvironment{Code}{Verbatim}{} | ||
\DefineVerbatimEnvironment{CodeInput}{Verbatim}{fontshape=sl} | ||
\DefineVerbatimEnvironment{CodeOutput}{Verbatim}{} | ||
\newenvironment{CodeChunk}{}{} | ||
|
||
% cite package, to clean up citations in the main text. Do not remove. | ||
\usepackage{cite} | ||
|
||
\usepackage{color} | ||
|
||
% Use doublespacing - comment out for single spacing | ||
%\usepackage{setspace} | ||
%\doublespacing | ||
|
||
|
||
% Text layout | ||
\topmargin 0.0cm | ||
\oddsidemargin 0.5cm | ||
\evensidemargin 0.5cm | ||
\textwidth 16cm | ||
\textheight 21cm | ||
|
||
% Bold the 'Figure #' in the caption and separate it with a period | ||
% Captions will be left justified | ||
\usepackage[labelfont=bf,labelsep=period,justification=raggedright]{caption} | ||
|
||
% Use the PLoS provided bibtex style | ||
\bibliographystyle{plos} | ||
|
||
% Remove brackets from numbering in List of References | ||
\makeatletter | ||
\renewcommand{\@biblabel}[1]{\quad#1.} | ||
\makeatother | ||
|
||
|
||
% Leave date blank | ||
\date{} | ||
|
||
\pagestyle{myheadings} | ||
%% ** EDIT HERE ** | ||
|
||
|
||
%% ** EDIT HERE ** | ||
%% PLEASE INCLUDE ALL MACROS BELOW | ||
|
||
%% END MACROS SECTION | ||
|
||
\begin{document} | ||
|
||
% Title must be 150 characters or less | ||
\begin{flushleft} | ||
{\Large | ||
\textbf{$title$} | ||
} | ||
% Insert Author names, affiliations and corresponding author email. | ||
\\ | ||
$for(author)$ | ||
$author.name$\textsuperscript{$author.affiliation$$if(author.email)$*$endif$}$sep$, | ||
$endfor$ | ||
\\ | ||
$for(affiliation)$ | ||
\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$ | ||
\\ | ||
$endfor$ | ||
|
||
\textasteriskcentered{} E-mail: $for(author)$ | ||
$if(author.email)$$author.email$$endif$ | ||
$endfor$ | ||
|
||
\end{flushleft} | ||
|
||
$body$ | ||
|
||
\end{document} | ||
|
17 changes: 17 additions & 0 deletions
17
inst/rmarkdown/templates/plos_article/skeleton/library.bib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@article{Garnier2007, | ||
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.}, | ||
author = {Garnier, Simon and Gautrais, Jacques and Theraulaz, Guy}, | ||
doi = {10.1007/s11721-007-0004-y}, | ||
file = {:Users/simongarnier/Work/bibliography/Mendeley/Swarm Intelligence/2007/Garnier, Gautrais, Theraulaz - 2007.pdf:pdf}, | ||
issn = {1935-3812}, | ||
journal = {Swarm Intelligence}, | ||
keywords = {self organization collective,self-organization collective,social insects,stigmergy,swarm intelligence}, | ||
mendeley-tags = {swarm intelligence}, | ||
month = jul, | ||
number = {1}, | ||
pages = {3--31}, | ||
title = {{The biological principles of swarm intelligence}}, | ||
url = {http://www.springerlink.com/index/10.1007/s11721-007-0004-y}, | ||
volume = {1}, | ||
year = {2007} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add header-includes (so users can easily include their own macros). That would look like this: https://github.com/rstudio/rmarkdown/blob/master/inst/rmarkdown/templates/tufte_handout/resources/tufte-handout.tex#L52-L54 and then require an "includes" argument be added to the plos_article function (and forwarded to pdf_document)