Skip to content
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
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export(acm_article)
export(acs_article)
export(aea_article)
export(ctex)
export(ctex_template)
export(elsevier_article)
Expand Down
27 changes: 27 additions & 0 deletions R/aea_article.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#' American Economic Association journal submissions.
#'
#' Format for creating submissions to the American Economic Association (AER, AEJ, JEL, PP). Adapted from
#' \href{https://www.aeaweb.org/journals/policies/templates}{https://www.aeaweb.org/journals/policies/templates}.
#'
#' @inheritParams rmarkdown::pdf_document
#' @param ... Additional 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 = "aea_article", package = "rticles")
#' }
#'
#' @export
aea_article <- function(...,
keep_tex = TRUE,
md_extensions = c("-autolink_bare_uris")) {
inherit_pdf_document(...,
template = find_resource("aea_article", "template.tex"),
keep_tex = keep_tex,
md_extensions = md_extensions)
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ The **rticles** package provides a suite of custom [R Markdown](http://rmarkdown

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

- [AEA](https://www.aeaweb.org/journals/policies/templates) journal submissions

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 its 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 release of RStudio (instructions for using **rticles** without RStudio are also provided).
Expand Down
54 changes: 54 additions & 0 deletions inst/rmarkdown/templates/aea_article/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
AEA_TEMPLATE_URL=https://www.aeaweb.org/content/file?id=57

all: inst /usr/local/bin/pdflatex

inst: aea_template \
template.yaml \
skeleton/aea.bst \
skeleton/AEA.cls \
skeleton/multicol.sty \
skeleton/setspace.sty \
skeleton/references.bib

aea_template.zip:
curl "$(AEA_TEMPLATE_URL)" -o $@

aea_template: aea_template.zip
unzip -j $< "latex_templates/*" -d $@

template.yaml:
mkdir -p $(dir $@)
echo "name: American Economics Association journals\ndescription: >\n Template for creating an article for submission to journals published by the American Economics Association: AEJ, AER, JEL, PP.\ncreate_dir: true" > $@

resources/template.tex: aer_template/AER-Article.tex
mkdir -p $(dir $@)
## cp $< $@
## I edited the included template to be compatible with R Markdown

skeleton/aea.bst: aea_template/aea.bst
mkdir -p $(dir $@)
cp $< $@

skeleton/AEA.cls: aea_template/AEA.cls
mkdir -p $(dir $@)
cp $< $@

skeleton/multicol.sty: aea_template/multicol.sty
mkdir -p $(dir $@)
cp $< $@

skeleton/setspace.sty: aea_template/setspace.sty
mkdir -p $(dir $@)
cp $< $@

skeleton/references.bib:
mkdir -p $(dir $@)
touch $@

/usr/local/bin/pdflatex:
ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin/pdflatex /usr/local/bin

clean:
rm -rf aea_template*


143 changes: 143 additions & 0 deletions inst/rmarkdown/templates/aea_article/resources/template.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
% AER-Article.tex for AEA last revised 22 June 2011
\documentclass[$journal$]{AEA}

% The mathtime package uses a Times font instead of Computer Modern.
% Uncomment the line below if you wish to use the mathtime package:
%\usepackage[cmbold]{mathtime}
% Note that miktex, by default, configures the mathtime package to use commercial fonts
% which you may not have. If you would like to use mathtime but you are seeing error
% messages about missing fonts (mtex.pfb, mtsy.pfb, or rmtmi.pfb) then please see
% the technical support document at http://www.aeaweb.org/templates/technical_support.pdf
% for instructions on fixing this problem.

% Note: you may use either harvard or natbib (but not both) to provide a wider
% variety of citation commands than latex supports natively. See below.

% Uncomment the next line to use the natbib package with bibtex
%\usepackage{natbib}

% Uncomment the next line to use the harvard package with bibtex
%\usepackage[abbr]{harvard}

% This command determines the leading (vertical space between lines) in draft mode
% with 1.5 corresponding to "double" spacing.
\draftSpacing{1.5}

\usepackage{hyperref}

\begin{document}

\title{$title$}
$if(short)$\shortTitle{$short$}$endif$
% \author{Author1 and Author2\thanks{Surname1: affiliation1, address1, email1.
% Surname2: affiliation2, address2, email2. Acknowledgements}}


\author{
$for(author)$
$author.name$$sep$\\
$endfor$
\thanks{
$for(author)$
$author.surname$: $author.affiliation$, \href{mailto:$author.email$}{$author.email$}.
$endfor$
$if(acknowldegements)$
$acknowledgements$
$endif$
}
}

\date{\today}
\pubMonth{$month$}
\pubYear{$year$}
\pubVolume{$vol$}
\pubIssue{$issue$}
\JEL{$for(jel)$$jel$$sep$, $endfor$}
\Keywords{$for(keywords)$$keywords$$sep$, $endfor$}

\begin{abstract}
$abstract$
\end{abstract}


\maketitle

American Economic Review Pointers:

\begin{itemize}
\item Do not use an "Introduction" heading. Begin your introductory material
before the first section heading.

\item Avoid style markup (except sparingly for emphasis).

\item Avoid using explicit vertical or horizontal space.

\item Captions are short and go below figures but above tables.

\item The tablenotes or figurenotes environments may be used below tables
or figures, respectively, as demonstrated below.

\item If you have difficulties with the mathtime package, adjust the package
options appropriately for your platform. If you can't get it to work, just
remove the package or see our technical support document online (please
refer to the author instructions).

\item If you are using an appendix, it goes last, after the bibliography.
Use regular section headings to make the appendix headings.

\item If you are not using an appendix, you may delete the appendix command
and sample appendix section heading.

\item Either the natbib package or the harvard package may be used with bibtex.
To include one of these packages, uncomment the appropriate usepackage command
above. Note: you can't use both packages at once or compile-time errors will result.

\end{itemize}

\section{First Section in Body}

Sample figure:

\begin{figure}
Figure here.

\caption{Caption for figure below.}
\begin{figurenotes}
Figure notes without optional leadin.
\end{figurenotes}
\begin{figurenotes}[Source]
Figure notes with optional leadin (Source, in this case).
\end{figurenotes}
\end{figure}

Sample table:

\begin{table}
\caption{Caption for table above.}

\begin{tabular}{lll}
& Heading 1 & Heading 2 \\
Row 1 & 1 & 2 \\
Row 2 & 3 & 4%
\end{tabular}
\begin{tablenotes}
Table notes environment without optional leadin.
\end{tablenotes}
\begin{tablenotes}[Source]
Table notes environment with optional leadin (Source, in this case).
\end{tablenotes}
\end{table}

References here (manual or bibTeX). If you are using bibTeX, add your bib file
name in place of BibFile in the bibliography command.
% Remove or comment out the next two lines if you are not using bibtex.
\bibliographystyle{aea}
\bibliography{references}

% The appendix command is issued once, prior to all appendices, if any.
\appendix

\section{Mathematical Appendix}

\end{document}

Loading