-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
11,215 additions
and
1,698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Type: Package | ||
Package: rticles | ||
Title: Article Formats for R Markdown | ||
Version: 0.27.3 | ||
Version: 0.27.7 | ||
Authors@R: c( | ||
person("JJ", "Allaire", , "[email protected]", role = "aut"), | ||
person("Yihui", "Xie", , "[email protected]", role = "aut", | ||
|
@@ -110,5 +110,5 @@ Config/Needs/website: magick, pdftools, gifski, tidyverse/tidytemplate, | |
Config/testthat/edition: 3 | ||
Encoding: UTF-8 | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.3.1 | ||
RoxygenNote: 7.3.2 | ||
SystemRequirements: GNU make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#' American Meteorological Society journals format. | ||
#' | ||
#' Format for creating submissions to American Meteorological Society journals. | ||
#' | ||
#' @inheritParams rmarkdown::pdf_document | ||
#' @param citation_package only natbib is supported with this template. | ||
#' @param ... Additional arguments to [rmarkdown::pdf_document()]. **Note**: `extra_dependencies` are not | ||
#' allowed as Copernicus does not support additional packages included via \code{\\usepackage{}}. | ||
#' | ||
#' @return An R Markdown output format. | ||
#' @details This was adapted from | ||
#' <https://www.ametsoc.org/index.cfm/ams/publications/author-information/latex-author-info/>. | ||
#' | ||
#' The template require some default knitr option to be change: | ||
#' | ||
#' * `echo = FALSE` as no R code should be shown | ||
#' * `fig.path = ""` as all directory paths need to be removed from figure names | ||
#' * `out.extra = ""` to force figure labels with knitr | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' library("rmarkdown") | ||
#' draft("MyArticle.Rmd", template = "ams", package = "rticles") | ||
#' render("MyArticle/MyArticle.Rmd") | ||
#' } | ||
#' @export | ||
ams_article <- function(..., keep_tex = TRUE, citation_package = "natbib", md_extensions = c("-autolink_bare_uris", "-auto_identifiers"), pandoc_args = NULL) { | ||
|
||
rmarkdown::pandoc_available('2.10', TRUE) | ||
|
||
if (citation_package != "natbib") { | ||
stop("AMS template supports only `natbib` for citation processing.") | ||
} | ||
|
||
pandoc_args <- c( | ||
pandoc_args, | ||
"--lua-filter", find_resource("ams", "ams.lua") | ||
) | ||
|
||
base <- pdf_document_format( | ||
"ams", keep_tex = keep_tex, md_extensions = md_extensions, citation_package = 'natbib', | ||
pandoc_args = pandoc_args, ... | ||
) | ||
pre_knit <- base$pre_knit | ||
base$pre_knit <- function(input, metadata, ...) { | ||
if (is.function(pre_knit)) pre_knit(input, metadata, ...) | ||
old_meta <- c("journal", "layout", "exauthors", "author1", "author2", "currentaddress", "affiliation") | ||
# check old arg | ||
metadata_used <- old_meta %in% names(metadata) | ||
if (any(metadata_used)) { | ||
warning("You are probably using an old version of the template - please update to new skeleton or keep using rticles 0.27.", immediate. = TRUE, call. = FALSE) | ||
warning("Some metadata are no more used in new AMS template: ", knitr::combine_words(old_meta[metadata_used]), ". They will be ignored.", immediate. = TRUE, call. = FALSE) | ||
} | ||
} | ||
base$knitr$opts_chunk <- merge_list(base$knitr$opts_chunk, list( | ||
fig.path = "", # AMS required | ||
out.extra = "", # To force figure labels | ||
echo = FALSE # Don't show R code | ||
)) | ||
return(base) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.