Skip to content

Commit d6748af

Browse files
committed
use pdf_document_format() in all output formats to make the source code much more consistent throughout the package, and turn \href{address}{address} to \url{address} (whoever introduced this please buy me a meal next time I meet you)
1 parent 97dd8c5 commit d6748af

24 files changed

+130
-402
lines changed

R/acm_article.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
#' }
1414
#' @export
1515
acm_article <- function(...) {
16-
pdf_document_format(
17-
..., format = "acm_article", template = "template.tex",
18-
csl = "acm-sig-proceedings.csl"
19-
)
16+
pdf_document_format("acm_article", csl = "acm-sig-proceedings.csl", ...)
2017
}
2118

R/acs_article.R

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@
44
#' Adapted from \url{http://pubs.acs.org/page/4authors/submission/tex.html}.
55
#' @inheritParams rmarkdown::pdf_document
66
#' @param ... Arguments to \code{rmarkdown::pdf_document}
7-
#' @return An R Markdown output format.
8-
#' @examples
9-
#' \dontrun{
10-
#' rmarkdown::draft("MyArticle.Rmd", template = "acs_article", package = "rticles")
11-
#' }
127
#' @export
138
acs_article <- function(
149
..., keep_tex = TRUE, md_extensions = c("-autolink_bare_uris"), fig_caption = TRUE
1510
) {
1611
pdf_document_format(
17-
..., keep_tex = keep_tex, md_extensions = md_extensions,
18-
format = "acs_article", template = "template.tex",
19-
csl = "american-chemical-society.csl", fig_caption = fig_caption
12+
"acs_article", keep_tex = keep_tex, md_extensions = md_extensions,
13+
csl = "american-chemical-society.csl", fig_caption = fig_caption, ...
2014
)
2115
}

R/aea_article.R

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
#' American Economic Association journal submissions.
22
#'
33
#' Format for creating submissions to the American Economic Association (AER, AEJ, JEL, PP).
4-
#'
54
#' @inheritParams rmarkdown::pdf_document
6-
#' @param ... Additional arguments to \code{rmarkdown::pdf_document}
7-
#'
8-
#' @return R Markdown output format to pass to
9-
#' \code{\link[rmarkdown:render]{render}}
10-
#'
11-
#' @examples
12-
#'
13-
#' \dontrun{
14-
#' library(rmarkdown)
15-
#' draft("MyArticle.Rmd", template = "aea_article", package = "rticles")
16-
#' }
17-
#'
5+
#' @param ... Additional arguments to \code{rmarkdown::pdf_document()}.
186
#' @export
19-
aea_article <- function(...,
20-
keep_tex = TRUE,
21-
md_extensions = c("-autolink_bare_uris")) {
22-
inherit_pdf_document(...,
23-
template = find_resource("aea_article", "template.tex"),
24-
keep_tex = keep_tex,
25-
md_extensions = md_extensions)
7+
aea_article <- function(..., keep_tex = TRUE, md_extensions = c("-autolink_bare_uris")) {
8+
pdf_document_format(
9+
"aea_article", keep_tex = keep_tex, md_extensions = md_extensions, ...
10+
)
2611
}

R/agu_article.R

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,13 @@
44
#' \url{https://publications.agu.org/author-resource-center/checklists-and-templates/}.
55
#' @inheritParams rmarkdown::pdf_document
66
#' @param ... Arguments to \code{rmarkdown::pdf_document()}.
7-
#' @return An R Markdown output format.
8-
#' @examples
9-
#' \dontrun{
10-
#' rmarkdown::draft("MyArticle.Rmd", template = "agu_article", package = "rticles")
11-
#' }
127
#' @export
138
agu_article <- function(
149
..., keep_tex = TRUE, citation_package = 'natbib',
1510
highlight = NULL, md_extensions = c("-autolink_bare_uris", "-auto_identifiers")
1611
) {
17-
inherit_pdf_document(
18-
template = find_resource("agu_article", "template.tex"), keep_tex = keep_tex,
19-
citation_package = citation_package, md_extensions = md_extensions,
20-
highlight = highlight, ...
12+
pdf_document_format(
13+
"agu_article", keep_tex = keep_tex, highlight = highlight,
14+
citation_package = citation_package, md_extensions = md_extensions, ...
2115
)
2216
}

R/amq_article.R

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
11
#' Format pour Bulletin de l'AMQ.
22
#'
33
#' Ce format a été adapté du format du bulletin de l'AMQ
4-
#'
54
#' @inheritParams rmarkdown::pdf_document
6-
#' @param ... Arguments to \code{rmarkdown::pdf_document}
7-
#' @return R Markdown output format to pass to \code{\link[rmarkdown:render]{render}}
8-
#' @examples
9-
#' \dontrun{
10-
#' rmarkdown::draft("MyArticle.Rmd", template = "amq_article", package = "rticles")
11-
#' }
12-
#'
5+
#' @param ... Arguments to \code{rmarkdown::pdf_document()}.
136
#' @export
14-
amq_article <- function(...,
15-
latex_engine = 'xelatex',
16-
keep_tex = TRUE,
17-
md_extensions = c("-autolink_bare_uris"),
18-
fig_caption = TRUE){
19-
pdf_document_format(...,
20-
latex_engine = latex_engine,
21-
highlight = NULL,
22-
keep_tex = keep_tex,
23-
md_extensions = md_extensions,
24-
format = "amq_article",
25-
template = "template.tex",
26-
csl = "",
27-
fig_caption = fig_caption)
7+
amq_article <- function(
8+
..., latex_engine = 'xelatex', keep_tex = TRUE, fig_caption = TRUE,
9+
md_extensions = c("-autolink_bare_uris")
10+
) {
11+
pdf_document_format(
12+
"amq_article", latex_engine = latex_engine, highlight = NULL, keep_tex = keep_tex,
13+
md_extensions = md_extensions, fig_caption = fig_caption, ...
14+
)
2815
}

R/ams_article.R

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,13 @@
22
#'
33
#' Format for creating an American Meteorological Society (AMS) Journal articles.
44
#' Adapted from
5-
#' \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/}.
6-
#'
5+
#' \url{https://www.ametsoc.org/ams/index.cfm/publications/authors/journal-and-bams-authors/author-resources/latex-author-info/}.
76
#' @inheritParams rmarkdown::pdf_document
8-
#' @param ... Arguments to \code{rmarkdown::pdf_document}
9-
#'
10-
#' @return R Markdown output format to pass to \code{\link[rmarkdown:render]{render}}
11-
#' @examples
12-
#'
13-
#' \dontrun{
14-
#' library(rmarkdown)
15-
#' draft("MyArticle.Rmd", template = "ams_article", package = "rticles")
16-
#' }
17-
#'
7+
#' @param ... Arguments to \code{rmarkdown::pdf_document()}.
188
#' @export
19-
ams_article <- function(...,
20-
keep_tex = TRUE,
21-
md_extensions = c("-autolink_bare_uris")){
22-
pdf_document_format(...,
23-
keep_tex = keep_tex,
24-
md_extensions = md_extensions,
25-
format = "ams_article",
26-
template = "template.tex",
27-
csl = "american-meteorological-society.csl")
9+
ams_article <- function(..., keep_tex = TRUE, md_extensions = c("-autolink_bare_uris")) {
10+
pdf_document_format(
11+
"ams_article", keep_tex = keep_tex, md_extensions = md_extensions,
12+
csl = "american-meteorological-society.csl", ...
13+
)
2814
}

R/asa_article.R

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,11 @@
22
#'
33
#' This format was adapted from The American Statistican format, but it
44
#' should be fairly consistent across ASA journals
5-
#'
65
#' @inheritParams rmarkdown::pdf_document
76
#' @param ... Arguments to \code{rmarkdown::pdf_document}
8-
#' @return R Markdown output format to pass to \code{\link[rmarkdown:render]{render}}
9-
#' @examples
10-
#' \dontrun{
11-
#' rmarkdown::draft("MyArticle.Rmd", template = "asa_article", package = "rticles")
12-
#' }
13-
#'
147
#' @export
15-
asa_article <- function(..., keep_tex = TRUE, citation_package = 'natbib'){
16-
template <- find_resource("asa_article", "template.tex")
17-
fmt <- inherit_pdf_document(template = template,
18-
keep_tex = keep_tex,
19-
citation_package = citation_package,
20-
...)
8+
asa_article <- function(..., keep_tex = TRUE, citation_package = 'natbib') {
9+
pdf_document_format(
10+
"asa_article", keep_tex = keep_tex, citation_package = citation_package, ...
11+
)
2112
}

R/biometrics_article.R

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
#' Biometrics Journal format.
22
#'
33
#' This format was adapted from the Biometrics Macro package.
4-
#'
5-
#'
64
#' @inheritParams rmarkdown::pdf_document
75
#' @param ... Arguments to \code{rmarkdown::pdf_document}
8-
#' @return R Markdown output format to pass to \code{\link[rmarkdown:render]{render}}
9-
#' @examples
10-
#' \dontrun{
11-
#' rmarkdown::draft("MyArticle.Rmd", template = "biometrics_article", package = "rticles")
12-
#' }
13-
#'
146
#' @export
15-
biometrics_article <- function(..., keep_tex = TRUE, citation_package = 'natbib'){
16-
template <- find_resource("biometrics_article", "template.tex")
17-
inherit_pdf_document(template = template,
18-
keep_tex = keep_tex,
19-
citation_package = citation_package,
20-
...)
7+
biometrics_article <- function(..., keep_tex = TRUE, citation_package = 'natbib') {
8+
pdf_document_format(
9+
'biometrics_article', keep_tex = keep_tex, citation_package = citation_package, ...
10+
)
2111
}

R/copernicus_article.R

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#' \code{\link[rmarkdown:render]{render}}
1111
#'
1212
#' @details This was adapted from
13-
#' \href{https://publications.copernicus.org/for_authors/manuscript_preparation.html}{https://publications.copernicus.org/for_authors/manuscript_preparation.html}.
13+
#' \url{https://publications.copernicus.org/for_authors/manuscript_preparation.html}.
1414
#'
1515
#' An number of required and optional manuscript sections, e.g. \code{acknowledgements}, \code{competinginterests}, or \code{authorcontribution}, must be declared using the respective properties of the R Markdown header - see skeleton file.
1616
#'
@@ -50,17 +50,15 @@
5050
#' }
5151
#'
5252
#' @export
53-
copernicus_article <- function(...,
54-
keep_tex = TRUE,
55-
citation_package = "natbib",
56-
md_extensions = c(
57-
"-autolink_bare_uris", # disables automatic links, needed for plain email in \correspondence
58-
"-auto_identifiers" # disables \hypertarget commands
59-
)) {
60-
inherit_pdf_document(
61-
..., citation_package = citation_package, keep_tex = keep_tex,
62-
md_extensions = md_extensions,
63-
template = find_resource("copernicus_article", "template.tex")
53+
copernicus_article <- function(
54+
..., keep_tex = TRUE, citation_package = "natbib", md_extensions = c(
55+
"-autolink_bare_uris", # disables automatic links, needed for plain email in \correspondence
56+
"-auto_identifiers" # disables \hypertarget commands
57+
)
58+
) {
59+
pdf_document_format(
60+
"copernicus_article", citation_package = citation_package,
61+
keep_tex = keep_tex, md_extensions = md_extensions, ...
6462
)
6563
}
6664

@@ -110,6 +108,7 @@ copernicus_journals <- list(
110108
#' @rdname copernicus_article
111109
#' @export
112110
copernicus_journal_abbreviations <- function(journal_name = "*") {
113-
journal <- copernicus_journals[grepl(pattern = journal_name, x = names(copernicus_journals), ignore.case = TRUE)]
114-
return(unlist(journal))
111+
unlist(copernicus_journals[grep(
112+
journal_name, names(copernicus_journals), ignore.case = TRUE
113+
)])
115114
}

R/elsevier_article.R

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,14 @@
11
#' Elsevier journal format.
22
#'
33
#' Format for creating submissions to Elsevier journals. Adapted from
4-
#' \href{https://www.elsevier.com/authors/author-schemas/latex-instructions}{https://www.elsevier.com/authors/author-schemas/latex-instructions}.
5-
#'
4+
#' \url{https://www.elsevier.com/authors/author-schemas/latex-instructions}.
65
#' @inheritParams rmarkdown::pdf_document
76
#' @param ... Additional arguments to \code{rmarkdown::pdf_document}
8-
#'
9-
#' @return R Markdown output format to pass to
10-
#' \code{\link[rmarkdown:render]{render}}
11-
#'
12-
#' @examples
13-
#'
14-
#' \dontrun{
15-
#' library(rmarkdown)
16-
#' draft("MyArticle.Rmd", template = "elsevier_article", package = "rticles")
17-
#' }
18-
#'
197
#' @export
20-
elsevier_article <- function(...,
21-
keep_tex = TRUE,
22-
md_extensions = c("-autolink_bare_uris")) {
23-
inherit_pdf_document(...,
24-
template = find_resource("elsevier_article", "template.tex"),
25-
keep_tex = keep_tex,
26-
md_extensions = md_extensions)
8+
elsevier_article <- function(
9+
..., keep_tex = TRUE, md_extensions = c("-autolink_bare_uris")
10+
) {
11+
pdf_document_format(
12+
"elsevier_article", keep_tex = keep_tex, md_extensions = md_extensions, ...
13+
)
2714
}

0 commit comments

Comments
 (0)