Skip to content

Commit

Permalink
Merge pull request #1 from rstudio/master
Browse files Browse the repository at this point in the history
update to current rstudio version
  • Loading branch information
cboettig committed Jun 8, 2016
2 parents e6da408 + 5e5b719 commit d8ecb8c
Show file tree
Hide file tree
Showing 82 changed files with 3,008 additions and 8,275 deletions.
38 changes: 30 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
Package: rticles
Type: Package
Title: What the package does (short line)
Version: 1.0
Date: 2014-03-14
Author: Who wrote it
Maintainer: Who to complain to <yourfault@somewhere.net>
Description: More about what it does (maybe more than one line)
Title: Article Formats for R Markdown
Version: 0.2
Date: 2016-04-24
Authors@R: c(
person("JJ", "Allaire", role = c("aut", "cre"), email = "jj@rstudio.com"),
person(family = "R Foundation", role = c("aut", "cph")),
person("Hadley", "Wickham", role = "aut", email = "hadley@rstudio.com"),
person(family = "Journal of Statistical Software", role = c("aut", "cph")),
person("Yihui", "Xie", role = "aut", email = "yihui@rstudio.com"),
person(family = "RStudio", role = "cph"),
person("Ramnath ", "Vaidyanathan", role = c("aut", "cph"), email = "ramnath.vaidya@gmail.com"),
person(family = "Assocation for Computing Machinery", role = c("aut", "cph")),
person("Carl", "Boettiger", role = c("aut", "cph"), email = "cboettig@gmail.com"),
person(family = "Elsevier", role = c("aut", "cph")),
person("Karl", "Broman", role = c("aut", "cph"), email = "kbroman@gmail.com"),
person("Kirill", "Mueller", role = c("aut", "cph"), email = "kirill.mueller@ivt.baug.ethz.ch"),
person("Bastiaan", "Quast", role = c("aut", "cph"), email = "bquast@gmail.com"),
person("Randall ", "Pruim", role = c("aut", "cph"), email = "rpruim@gmail.com"),
person("Ben", "Marwick", role = c("aut", "cph"), email = "bmarwick@uw.edu"),
person("Charlotte", "Wickham", role = c("aut", "cph"), email = "cwickham@gmail.com"),
person("Oliver", "Keyes", role = c("aut", "cph"), email = "okeyes@wikimedia.org"),
person("Miao", "Yu", role = c("aut", "cph"), email = "yufreecas@gmail.com")
)
Description: A suite of custom R Markdown formats and templates for
authoring journal articles and conference submissions.
License: GPL-3
Imports:
rmarkdown
Imports: utils, rmarkdown, knitr, yaml
SystemRequirements: GNU make
RoxygenNote: 5.0.1
Suggests: testthat

12 changes: 5 additions & 7 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Generated by roxygen2 (4.1.1): do not edit by hand
# Generated by roxygen2: do not edit by hand

export(acm)
export(acs)
export(acm_article)
export(acs_article)
export(ctex)
export(ctex_template)
export(frontiers_article)
export(elsevier_article)
export(jss_article)
export(plos_article)
export(rjournal_article)
export(tufte_ebook)
export(use_r_abstract)
30 changes: 23 additions & 7 deletions R/acm_article.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
#' Association for Computing Machinery (ACM) format.
#'
#' Format for creating an Association for Computing Machinery (ACM) articles.
#' Adapted from
#' \href{http://www.acm.org/publications/article-templates/proceedings-template.html}{http://www.acm.org/publications/article-templates/proceedings-template.html}.
#'
#' @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 = "acm_article", package = "rticles")
#' }
#'
#' @export
acm <- function() {
template <- find_resource("acm", "template.tex")
csl <- find_resource("acm" ,"acm-sig-proceedings.csl")

rmarkdown::pdf_document(
template = template,
pandoc_args = c("--csl", rmarkdown::pandoc_path_arg(csl)))
acm_article <- function(...) {
pdf_document_format(...,
format = "acm_article",
template = "template.tex",
csl = "acm-sig-proceedings.csl")
}

37 changes: 28 additions & 9 deletions R/acs_article.R
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
#' American Chemical Society (ACS) Journal format.
#'
#' Format for creating an American Chemical Society (ACS) Journal articles.
#' Adapted from
#' \href{http://pubs.acs.org/page/4authors/submission/tex.html}{http://pubs.acs.org/page/4authors/submission/tex.html}.
#'
#' @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 = "acs_article", package = "rticles")
#' }
#'
#' @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 = TRUE,
template = template,
pandoc_args = c("--csl", rmarkdown::pandoc_path_arg(csl)))
acs_article <- function(...,
keep_tex = TRUE,
md_extensions = c("-autolink_bare_uris"),
fig_caption = TRUE){
pdf_document_format(...,
keep_tex = keep_tex,
md_extensions = md_extensions,
format = "acs_article",
template = "template.tex",
csl = "american-chemical-society.csl",
fig_caption = fig_caption)
}
28 changes: 25 additions & 3 deletions R/ctex.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
#' A LaTeX template for Chinese documents
#' A PDF format for documents based on the LaTeX package \pkg{ctex}
#'
#' This function returns the path to a LaTeX template for Chinese documents
#' using the ctex package.
#' \code{ctex()} is a wrapper function for \code{rmarkdown::pdf_document()} and
#' changed the default values of two arguments \code{template} and
#' \code{latex_engine} so it works better with the \pkg{ctex} package.
#' @param ...,template,latex_engine Passed to
#' \code{markdown::\link[rmarkdown]{pdf_document}()}
#' @return \code{ctex()} returns a format that can be passed to
#' \code{rmarkdown::render()}; \code{ctex_template()} returns the path to a
#' LaTeX template in \pkg{rticles} for Chinese documents using the \pkg{ctex}
#' package.
#'
#' @examples
#'
#' \dontrun{
#' library(rmarkdown)
#' draft("MyArticle.Rmd", template = "ctex", package = "rticles")
#' }
#'
#' @export
ctex <- function(..., template = ctex_template(), latex_engine = 'xelatex') {
inherit_pdf_document(..., template = template, latex_engine = latex_engine)
}


#' @rdname ctex
#' @export
ctex_template <- function() find_resource('ctex', 'default.latex')
27 changes: 27 additions & 0 deletions R/elsevier_article.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#' Elsevier journal format.
#'
#' Format for creating submissions to Elsevier journals. Adapted from
#' \href{https://www.elsevier.com/authors/author-schemas/latex-instructions}{https://www.elsevier.com/authors/author-schemas/latex-instructions}.
#'
#' @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 = "elsevier_article", package = "rticles")
#' }
#'
#' @export
elsevier_article <- function(...,
keep_tex = TRUE,
md_extensions = c("-autolink_bare_uris")) {
inherit_pdf_document(...,
template = find_resource("elsevier_article", "template.tex"),
keep_tex = keep_tex,
md_extensions = md_extensions)
}
39 changes: 0 additions & 39 deletions R/frontiers_article.R

This file was deleted.

29 changes: 25 additions & 4 deletions R/jss_article.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
#' Journal of Statistical Software (JSS) format.
#'
#' Format for creating a Journal of Statistical Software (JSS) articles. Adapted
#' from
#' \href{http://www.jstatsoft.org/about/submissions}{http://www.jstatsoft.org/about/submissions}.
#'
#' @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 = "jss_article", package = "rticles")
#' }
#'
#' @export
jss_article <- function() {
jss_article <- function(..., keep_tex = TRUE) {

template <- find_resource("jss_article", "template.tex")

base <- rmarkdown::pdf_document(template = template, keep_tex = TRUE)
base <- inherit_pdf_document(..., template = template, keep_tex = keep_tex)

# Mostly copied from knitr::render_sweave
base$knitr$opts_knit$out.format <- "sweave"
Expand All @@ -17,7 +37,7 @@ jss_article <- function() {
base$knitr$opts_chunk$fig.align <- "center"

hook_chunk <- function(x, options) {
if (knitr:::output_asis(x, options)) return(x)
if (output_asis(x, options)) return(x)
paste0('\\begin{CodeChunk}\n', x, '\\end{CodeChunk}')
}
hook_input <- function(x, options) {
Expand All @@ -33,7 +53,8 @@ jss_article <- function() {
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$knitr$knit_hooks$plot <- knitr::hook_plot_tex

base
}

38 changes: 0 additions & 38 deletions R/plos_article.R

This file was deleted.

Loading

0 comments on commit d8ecb8c

Please sign in to comment.