Skip to content

add acs template #15

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

Merged
merged 2 commits into from
Nov 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export(acm)
export(jss_article)
export(rjournal_article)
export(use_r_abstract)
export(plos_article)
export(acs)
11 changes: 11 additions & 0 deletions R/acs_article.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#' @export
acs <- function(keep_tex = TRUE) {
template <- find_resource("acs", "template.tex")
csl <- find_resource("acs" ,"american-chemical-society.csl")

rmarkdown::pdf_document(
keep_tex = keep_tex,
fig_caption = T,
template = template,
pandoc_args = c("--csl", rmarkdown::pandoc_path_arg(csl)))
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The **rticles** package includes a set of [R Markdown](http://rmarkdown.rstudio.

- [Public Library of Science (PLoS)](http://www.plos.org/) articles

- [ACS](http://pubs.acs.org) articles

Under the hood, LaTeX templates are used to ensure that documents conform precisely to submission standards. At the same time, composition and formatting can be done using lightweight [markdown](http://rmarkdown.rstudio.com/authoring_basics.html) syntax, and R code and it's output can be seamlessly included using [knitr](http://yihui.name/knitr/).

Using **rticles** has some prerequisites which are described below. You can get most of these pre-requisites automatically by installing the latest preview release of RStudio (instructions for using **rticles** without RStudio are also provided).
Expand Down
204 changes: 204 additions & 0 deletions inst/rmarkdown/templates/acs/resources/american-chemical-society.csl
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" page-range-format="expanded" default-locale="en-US">
<info>
<title>American Chemical Society</title>
<title-short>ACS</title-short>
<id>http://www.zotero.org/styles/american-chemical-society</id>
<link href="http://www.zotero.org/styles/american-chemical-society" rel="self"/>
<link href="http://pubs.acs.org/doi/pdf/10.1021/bk-2006-STYG.ch014" rel="documentation"/>
<author>
<name>Julian Onions</name>
<email>[email protected]</email>
</author>
<contributor>
<name>Ivan Bushmarinov</name>
<email>[email protected]</email>
</contributor>
<category citation-format="numeric"/>
<category field="chemistry"/>
<summary>The American Chemical Society style.</summary>
<updated>2014-09-06T22:02:33+00:00</updated>
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
<macro name="editor">
<names variable="editor">
<name sort-separator=", " initialize-with=". " name-as-sort-order="all" delimiter="; " delimiter-precedes-last="always"/>
<label form="short" prefix=", " text-case="capitalize-first"/>
</names>
</macro>
<macro name="author">
<names variable="author" suffix=".">
<name sort-separator=", " initialize-with=". " name-as-sort-order="all" delimiter="; " delimiter-precedes-last="always"/>
<label form="short" prefix=", " text-case="capitalize-first"/>
</names>
</macro>
<macro name="publisher">
<group delimiter=": ">
<text variable="publisher"/>
<text variable="publisher-place"/>
</group>
</macro>
<macro name="volume">
<group delimiter=" ">
<text term="volume" form="short" text-case="capitalize-first"/>
<text variable="volume"/>
</group>
</macro>
<macro name="series">
<text variable="collection-title"/>
</macro>
<macro name="pages">
<label variable="page" form="short" suffix=" "/>
<text variable="page"/>
</macro>
<macro name="book-container">
<group delimiter=" ">
<text term="in" text-case="capitalize-first"/>
<text variable="container-title" font-style="italic"/>
</group>
</macro>
<macro name="issued">
<date variable="issued" delimiter=" ">
<date-part name="year"/>
</date>
</macro>
<macro name="full-issued">
<date variable="issued" delimiter=" ">
<date-part name="month" form="long" suffix=" "/>
<date-part name="day" suffix=", "/>
<date-part name="year"/>
</date>
</macro>
<macro name="edition">
<choose>
<if is-numeric="edition">
<group delimiter=" ">
<number variable="edition" form="ordinal"/>
<text term="edition" form="short"/>
</group>
</if>
<else>
<text variable="edition" suffix="."/>
</else>
</choose>
</macro>
<citation collapse="citation-number">
<sort>
<key variable="citation-number"/>
</sort>
<layout delimiter="," vertical-align="sup">
<text variable="citation-number"/>
</layout>
</citation>
<bibliography second-field-align="flush" entry-spacing="0">
<layout suffix=".">
<text variable="citation-number" prefix="(" suffix=") "/>
<text macro="author" suffix=" "/>
<choose>
<if type="article-magazine">
<group delimiter=" ">
<text variable="container-title" font-style="italic" suffix="."/>
<text macro="edition"/>
<text macro="publisher"/>
<text macro="full-issued" suffix=","/>
<text macro="pages"/>
</group>
</if>
<else-if type="thesis">
<group delimiter=", ">
<group delimiter=". ">
<text variable="title"/>
<text variable="genre"/>
</group>
<text macro="publisher"/>
<text macro="issued"/>
<text macro="volume"/>
<text macro="pages"/>
</group>
</else-if>
<else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
<group delimiter="; ">
<text variable="title" font-style="italic"/>
<text macro="editor" prefix=" "/>
<text macro="series"/>
<text macro="edition"/>
<choose>
<if type="report">
<group delimiter=" ">
<text variable="genre"/>
<text variable="number"/>
</group>
</if>
</choose>
<group delimiter=", ">
<text macro="publisher"/>
<text macro="issued"/>
</group>
<group delimiter=", ">
<text macro="volume"/>
<text macro="pages"/>
</group>
</group>
</else-if>
<else-if type="patent">
<group delimiter=", ">
<group delimiter=". ">
<text variable="title"/>
<text variable="number"/>
</group>
<date variable="issued" form="text"/>
</group>
</else-if>
<else-if type="chapter paper-conference" match="any">
<group delimiter="; ">
<text macro="book-container"/>
<text macro="editor"/>
<text macro="series"/>
<group delimiter=", ">
<text macro="publisher"/>
<text macro="issued"/>
</group>
<group delimiter=", ">
<text macro="volume"/>
<text macro="pages"/>
</group>
</group>
</else-if>
<else-if type="webpage">
<group delimiter=" ">
<text variable="title"/>
<text variable="URL"/>
<date variable="accessed" prefix="(accessed " suffix=")" delimiter=" ">
<date-part name="month" form="short" strip-periods="true"/>
<date-part name="day" suffix=", "/>
<date-part name="year"/>
</date>
</group>
</else-if>
<else-if type="article-journal">
<group delimiter=" ">
<text variable="container-title" font-style="italic" form="short"/>
<group delimiter=", ">
<text macro="issued" font-weight="bold"/>
<text variable="volume" font-style="italic"/>
<text variable="page"/>
</group>
</group>
</else-if>
<else>
<group delimiter=", ">
<group delimiter=". ">
<text variable="title"/>
<text variable="container-title" font-style="italic"/>
</group>
<group delimiter=", ">
<text macro="issued"/>
<text variable="volume" font-style="italic"/>
<text variable="page"/>
</group>
</group>
</else>
</choose>
</layout>
</bibliography>
</style>
43 changes: 43 additions & 0 deletions inst/rmarkdown/templates/acs/resources/template.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
\documentclass[journal=$journal$,manuscript=$type$]{achemso}
\usepackage[version=3]{mhchem}
\usepackage{amsmath}
\newcommand*\mycommand[1]{\texttt{\emph{#1}}}
$for(author)$
\author{$author.name$}
$if(author.aff)$
\affiliation{$author.aff$}
$endif$
$if(author.alsoaff)$
\alsoaffiliation{$author.alsoaff$}
$endif$
$if(author.altaff)$
\altaffiliation{$author.altaff$}
$endif$
$if(author.mail)$
\email{$author.mail$}
$endif$
$if(author.phone)$
\phone{$author.phone$}
$endif$
$if(author.fax)$
\fax{$author.fax$}
$endif$
$endfor$

$if(abbr)$
\abbreviations{$abbr$}
$endif$

$if(keywords)$
\keywords{$keywords$}
$endif$

\title[$title.short$]{$title.formatted$}
\makeatletter
\begin{document}

$body$

\end{document}


5 changes: 5 additions & 0 deletions inst/rmarkdown/templates/acs/skeleton/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Known issues
===
- email escape
- muti-author problem(soloved 20141104)
- figure: echo must be set as F to show figure in a chunk
17 changes: 17 additions & 0 deletions inst/rmarkdown/templates/acs/skeleton/acstest.bib
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}
}
Loading