Skip to content

Commit 24d069f

Browse files
committed
remove the base_format argument from peerj_article() (#127) and copernicus_article() (#172)
1 parent e35d144 commit 24d069f

File tree

8 files changed

+25
-50
lines changed

8 files changed

+25
-50
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: rticles
22
Type: Package
33
Title: Article Formats for R Markdown
4-
Version: 0.6.2
4+
Version: 0.6.3
55
Authors@R: c(
66
person("JJ", "Allaire", role = "aut", email = "[email protected]"),
77
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ rticles 0.7
77

88
- Added an argument `pandoc_args` to `ieee_article()` so that users can pass custom Pandoc arguments. This also makes it work with `bookdown::pdf_book()` (thanks, @espinielli, #206).
99

10+
- The `base_format` argument has been removed from `peerj_article()` and `copernicus_article()`. This argument was originally added mainly for supporting `bookdown::pdf_book()`, but you should really pass these formats to the `base_format` argument of `bookdown::pdf_book` instead of the other way around.
11+
1012
rticles 0.6
1113
---------------------------------------------------------------------
1214

R/copernicus_article.R

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
#' Format for creating submissions to Copernicus journals.
44
#'
55
#' @inheritParams rmarkdown::pdf_document
6-
#' @param ... Additional arguments to \code{base_format}
7-
#' @param base_format The function to use for the base format of the article.
8-
#' By default, this is \code{rmarkdown::pdf_document}, but to use bookdown's
9-
#' cross-referencing feature, this can be set to \code{bookdown::pdf_document2}
6+
#' @param ... Additional arguments to \code{rmarkdown::pdf_document()}.
107
#' @param journal_name A regular expression to filter the by the journal name, see \code{pattern} in \code{\link[base]{grep}}; defaults to \code{*}.
118
#'
129
#' @return R Markdown output format to pass to
@@ -56,21 +53,15 @@
5653
copernicus_article <- function(...,
5754
keep_tex = TRUE,
5855
citation_package = "natbib",
59-
base_format = rmarkdown::pdf_document,
6056
md_extensions = c(
6157
"-autolink_bare_uris", # disables automatic links, needed for plain email in \correspondence
6258
"-auto_identifiers" # disables \hypertarget commands
6359
)) {
64-
if (is.character(base_format)) {
65-
FMT <- eval(parse(text = base_format))
66-
} else {
67-
FMT <- match.fun(base_format)
68-
}
69-
FMT(...,
70-
citation_package = citation_package,
71-
keep_tex = keep_tex,
72-
md_extensions = md_extensions,
73-
template = find_resource("copernicus_article", "template.tex"))
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")
64+
)
7465
}
7566

7667
# quick dev shortcut for Ubuntu: click "Install and restart" then run:

R/peerj_article.R

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
#' Format for creating submissions to The PeerJ.
44
#'
55
#' @inheritParams rmarkdown::pdf_document
6-
#' @param ... Additional arguments to \code{base_format}
7-
#' @param base_format The function to use for the base format of the article.
8-
#' By default, this is \code{rmarkdown::pdf_document}, but to use bookdown's
9-
#' cross-referencing feature, this can be set to \code{bookdown::pdf_document2}
10-
#'
6+
#' @param ... Additional arguments to \code{rmarkdown::pdf_document()}.
117
#' @return R Markdown output format to pass to
128
#' \code{\link[rmarkdown:render]{render}}
139
#'
@@ -26,15 +22,9 @@
2622
#' }
2723
#'
2824
#' @export
29-
peerj_article <- function(..., keep_tex = TRUE, citation_package = "none",
30-
base_format = rmarkdown::pdf_document) {
31-
if (inherits(base_format, "character")){
32-
FMT <- eval(parse(text = base_format))
33-
} else {
34-
FMT <- match.fun(base_format)
35-
}
36-
out <- FMT(...,
37-
citation_package = citation_package,
38-
keep_tex = keep_tex,
39-
template = find_resource("peerj_article", "template.tex"))
25+
peerj_article <- function(..., keep_tex = TRUE, citation_package = "none") {
26+
inherit_pdf_document(
27+
..., citation_package = citation_package, keep_tex = keep_tex,
28+
template = find_resource("peerj_article", "template.tex")
29+
)
4030
}

inst/rmarkdown/templates/copernicus_article/skeleton/skeleton.Rmd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ appendix: |
6464
6565
Please add `\clearpage` between each table and/or figure. Further guidelines on figures and tables can be found below.
6666
output:
67-
rticles::copernicus_article:
68-
base_format: rmarkdown::pdf_document
67+
rticles::copernicus_article: default
68+
bookdown::pdf_book:
69+
base_format: rticles::copernicus_article # for using bookdown features like \@ref()
6970
---
7071

7172
\introduction

inst/rmarkdown/templates/peerj_article/skeleton/skeleton.Rmd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ abstract: >
1919
header-includes: >
2020
\usepackage{lipsum}
2121
bibliography: sample.bib
22-
output:
23-
rticles::peerj_article:
24-
base_format: rmarkdown::pdf_document # bookdown::pdf_document2 # for using \@ref()
22+
output:
23+
bookdown::pdf_book:
24+
base_format: rticles::peerj_article # for using bookdown features like \@ref()
25+
rticles::peerj_article: default
2526
---
2627

2728

man/copernicus_article.Rd

Lines changed: 1 addition & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/peerj_article.Rd

Lines changed: 2 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)