Skip to content
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

Template for the journals from American Meteorological Society #96

Merged
merged 6 commits into from
Dec 4, 2016
Merged
Show file tree
Hide file tree
Changes from 2 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
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
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>
70 changes: 70 additions & 0 deletions inst/rmarkdown/templates/ams_article/resources/template.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
\documentclass[$col$]{ametsoc}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any of the pandoc includes in this template (e.g. include-header, include-before, include-after). Should these be added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's convenient!
I also add include-header into the ACS template.
Thanks!

\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$

\abstract{$abstract$}
\begin{document}
\maketitle
$body$
\end{document}
Loading