Skip to content

Commit

Permalink
Merge pull request #96 from yufree/master
Browse files Browse the repository at this point in the history
Template for the journals from American Meteorological Society
  • Loading branch information
jjallaire authored Dec 4, 2016
2 parents 6466cdf + c6d889b commit 10a396d
Show file tree
Hide file tree
Showing 12 changed files with 1,056 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
export(acm_article)
export(acs_article)
export(aea_article)
export(ams_article)
export(ctex)
export(ctex_template)
export(elsevier_article)
Expand Down
28 changes: 28 additions & 0 deletions R/ams_article.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#' American Meteorological Society (AMS) Journal format.
#'
#' Format for creating an American Meteorological Society (AMS) Journal articles.
#' Adapted from
#' \href{https://www.ametsoc.org/ams/index.cfm/publications/authors/journal-and-bams-authors/author-resources/latex-author-info/}{https://www.ametsoc.org/ams/index.cfm/publications/authors/journal-and-bams-authors/author-resources/latex-author-info/}.
#'
#' @inheritParams rmarkdown::pdf_document
#' @param ... Arguments to \code{rmarkdown::pdf_document}
#'
#' @return R Markdown output format to pass to \code{\link[rmarkdown:render]{render}}
#' @examples
#'
#' \dontrun{
#' library(rmarkdown)
#' draft("MyArticle.Rmd", template = "ams_article", package = "rticles")
#' }
#'
#' @export
ams_article <- function(...,
keep_tex = TRUE,
md_extensions = c("-autolink_bare_uris")){
pdf_document_format(...,
keep_tex = keep_tex,
md_extensions = md_extensions,
format = "ams_article",
template = "template.tex",
csl = "american-meteorological-society.csl")
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ The **rticles** package provides a suite of custom [R Markdown](http://rmarkdown

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

- [AMS](https://www.ametsoc.org/) articles

- [Elsevier](https://www.elsevier.com) journal submissions

- [AEA](https://www.aeaweb.org/journals/policies/templates) journal submissions
Expand Down
13 changes: 13 additions & 0 deletions inst/rmarkdown/templates/acs_article/resources/template.tex
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,22 @@
% avoid problems with \sout in headers with hyperref:
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
$endif$
% pandoc header
$for(header-includes)$
$header-includes$
$endfor$

\begin{document}
$for(include-before)$
$include-before$

$endfor$
\begin{abstract}
$abstract$
\end{abstract}
$body$
$for(include-after)$
$include-after$

$endfor$
\end{document}
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
<?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 Meteorological Society</title>
<title-short>AMS</title-short>
<id>http://www.zotero.org/styles/american-meteorological-society</id>
<link href="http://www.zotero.org/styles/american-meteorological-society" rel="self"/>
<link href="http://www.zotero.org/styles/cold-spring-harbor-laboratory-press" rel="template"/>
<link href="http://www.ametsoc.org/pubs/journals/author_reference_guide.pdf" rel="documentation"/>
<author>
<name>Carl J. Schreck, III</name>
<email>carl.schreck@gmail.com</email>
</author>
<contributor>
<name>Rintze Zelle</name>
<uri>http://twitter.com/rintzezelle</uri>
</contributor>
<category citation-format="author-date"/>
<category field="geography"/>
<summary>A style for all journals by the American Meteorological Society</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>
<locale xml:lang="en">
<terms>
<term name="page" form="short">
<single>p.</single>
<multiple/>
</term>
<term name="and others">and Coauthors</term>
</terms>
</locale>
<macro name="editor">
<names variable="editor">
<name and="text" delimiter=", " initialize-with=".">
<name-part name="family" text-case="capitalize-first"/>
<name-part name="given" text-case="capitalize-first"/>
</name>
<label form="short" text-case="capitalize-first" prefix=", "/>
</names>
</macro>
<macro name="series-editor">
<names variable="original-author">
<label form="short" text-case="capitalize-first" suffix=" "/>
<name and="text" delimiter=", "/>
</names>
</macro>
<macro name="author">
<names variable="author">
<name and="text" name-as-sort-order="first" sort-separator=", " delimiter=", " delimiter-precedes-last="always" delimiter-precedes-et-al="always" initialize-with=". "/>
<et-al term="and others"/>
<label form="short" prefix=", "/>
<substitute>
<names variable="editor"/>
<names variable="translator"/>
</substitute>
</names>
</macro>
<macro name="author-count">
<names variable="author">
<name form="count"/>
<substitute>
<names variable="editor"/>
<names variable="translator"/>
</substitute>
</names>
</macro>
<macro name="author-short">
<names variable="author">
<name form="short" and="text" delimiter=", "/>
<substitute>
<names variable="editor"/>
<names variable="translator"/>
</substitute>
</names>
</macro>
<macro name="access">
<choose>
<if variable="URL">
<text variable="URL"/>
<group prefix=" (" suffix=")">
<text term="accessed" text-case="capitalize-first" suffix=" "/>
<date variable="accessed">
<date-part name="month" suffix=" "/>
<date-part name="day" suffix=", "/>
<date-part name="year"/>
</date>
</group>
</if>
</choose>
</macro>
<macro name="title">
<choose>
<if type="thesis">
<text variable="title"/>
</if>
<else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
<text variable="title" font-style="italic"/>
</else-if>
<else>
<text variable="title"/>
</else>
</choose>
</macro>
<macro name="publisher">
<group delimiter=", ">
<text variable="publisher"/>
<text variable="publisher-place"/>
</group>
</macro>
<macro name="year-date">
<date variable="issued">
<date-part name="year"/>
</date>
</macro>
<macro name="day-month">
<date variable="issued">
<date-part name="month"/>
<date-part name="day" prefix=" "/>
</date>
</macro>
<macro name="page">
<label variable="page" suffix=" " form="short"/>
<text variable="page"/>
</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 et-al-min="3" et-al-use-first="1" disambiguate-add-year-suffix="true" collapse="year-suffix" year-suffix-delimiter=",">
<layout prefix="(" suffix=")" delimiter="; ">
<group delimiter=", ">
<group delimiter=" ">
<text macro="author-short"/>
<text macro="year-date"/>
</group>
<group delimiter=" ">
<label variable="locator" form="short"/>
<text variable="locator"/>
</group>
</group>
</layout>
</citation>
<bibliography hanging-indent="true" et-al-min="9" et-al-use-first="1" subsequent-author-substitute="&#8212;&#8212;" subsequent-author-substitute-rule="partial-each">
<sort>
<key macro="author" names-min="1" names-use-first="1"/>
<key macro="author-count" names-min="3" names-use-first="3"/>
<key macro="year-date"/>
<key macro="author"/>
</sort>
<layout suffix=".">
<group delimiter=" ">
<text macro="author" suffix=","/>
<text macro="year-date" suffix=":"/>
</group>
<choose>
<if type="article-newspaper article-magazine" match="any">
<group delimiter=" ">
<text macro="title" prefix=" " suffix="."/>
</group>
<group prefix=" " delimiter=", ">
<text variable="container-title" font-style="italic"/>
<text macro="day-month"/>
<text variable="edition"/>
</group>
</if>
<else-if type="thesis">
<text macro="title" prefix=" " suffix=". "/>
<text variable="publisher" suffix=", "/>
<text variable="number-of-pages" suffix=" pp."/>
</else-if>
<else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
<group delimiter=" ">
<text macro="title" prefix=" " suffix="."/>
<text macro="edition"/>
<text macro="editor" suffix="."/>
<text macro="publisher" suffix=","/>
<text variable="number-of-pages" suffix=" pp."/>
</group>
</else-if>
<else-if type="paper-conference">
<group delimiter=" ">
<text macro="title" prefix=" " suffix="."/>
<group delimiter=", ">
<group delimiter=", ">
<text variable="container-title" font-style="italic"/>
<text macro="editor"/>
</group>
<group delimiter=" ">
<text variable="volume" prefix="Vol. " suffix=" of"/>
<text variable="collection-title" font-style="italic"/>
<text macro="series-editor"/>
</group>
<text variable="event"/>
<text variable="publisher-place"/>
<text variable="publisher"/>
<text variable="page"/>
</group>
</group>
</else-if>
<else-if type="chapter paper-conference" match="any">
<group delimiter=" ">
<text macro="title" prefix=" " suffix="."/>
<group delimiter=", ">
<group delimiter=", ">
<text variable="container-title" font-style="italic"/>
<text macro="editor"/>
</group>
<group delimiter=" ">
<text variable="volume" prefix="Vol. " suffix=" of"/>
<text variable="collection-title" font-style="italic"/>
<text macro="series-editor"/>
</group>
<text macro="publisher" prefix=" "/>
<text macro="page"/>
</group>
</group>
</else-if>
<else>
<group suffix=".">
<text macro="title" prefix=" "/>
</group>
<group prefix=" " suffix="." delimiter=" ">
<text variable="container-title" form="short" font-style="italic" suffix=","/>
<group delimiter=", ">
<text variable="volume" font-weight="bold"/>
<text variable="page"/>
<text variable="DOI" prefix="doi:"/>
</group>
</group>
</else>
</choose>
<text prefix=" " macro="access" suffix="."/>
</layout>
</bibliography>
</style>
81 changes: 81 additions & 0 deletions inst/rmarkdown/templates/ams_article/resources/template.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
\documentclass[$layout$]{ametsoc}
\usepackage{color}
\usepackage{hyperref}
\journal{$journal$}
% Please choose a journal abbreviation to use above from the following list:
%
% jamc (Journal of Applied Meteorology and Climatology)
% jtech (Journal of Atmospheric and Oceanic Technology)
% jhm (Journal of Hydrometeorology)
% jpo (Journal of Physical Oceanography)
% jas (Journal of Atmospheric Sciences)
% jcli (Journal of Climate)
% mwr (Monthly Weather Review)
% wcas (Weather, Climate, and Society)
% waf (Weather and Forecasting)
% bams (Bulletin of the American Meteorological Society)
% ei (Earth Interactions)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Citations should be of the form ``author year'' not ``author, year''
\bibpunct{(}{)}{;}{a}{}{,}
\title{$title$}

$if(author1)$
\authors{$author1$
$if(correspondingauthor)$
\correspondingauthor{$author1$,$correspondingauthor$}
$endif$
$endif$
$if(author2)$
and $author2$
$if(currentaddress)$
\thanks{$currentaddress$}}
$endif$
$endif$
$if(affiliation)$
\affiliation{$affiliation$}
$endif$
$if(extraauthor)$
\extraauthor{Extra Author}
$endif$
$if(exaffiliation)$
\extraaffil{$exaffiliation$}
$endif$

$if(email)$
$email$
$endif$

$for(exauthors)$
\extraauthor{$exauthors.name$
$if(exauthors.correspondingauthor)$
\correspondingauthor{$exauthors.name$,$exauthors.correspondingauthor$}
$endif$
$if(exauthors.currentaddress)$
\thanks{$exauthors.currentaddress$}
$endif$}
$if(exauthors.exaffiliation)$
\extraaffil{$exauthors.exaffiliation$}
$endif$
$if(exauthors.email)$
$exauthors.email$
$endif$
$endfor$
% pandoc header
$for(header-includes)$
$header-includes$
$endfor$
\abstract{$abstract$}
\begin{document}
\maketitle
$for(include-before)$
$include-before$

$endfor$
$body$
$for(include-after)$
$include-after$

$endfor$
\end{document}
Loading

0 comments on commit 10a396d

Please sign in to comment.