diff --git a/DESCRIPTION b/DESCRIPTION index 8eda79d88..c77615af5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,8 +27,9 @@ Authors@R: c( person("Marc-Andre", "Desautels", role = c("aut", "cph"), email = "marc-andre.desautels@cstjean.qc.ca"), person("Dominik", "Leutnant", role = c("aut", "cph"), email = "leutnant@fh-muenster.de"), person(family = "MDPI", role = c("aut", "cph")), - person("Oğuzhan", "Öğreden", role = c("aut"), comment = c(ORCID = "0000-0002-9949-3348"), - person("Daniel", "Nüst", role = c("aut", "cph"), email = "daniel.nuest@uni-muenster.de")) + person("Oğuzhan", "Öğreden", role = c("aut"), comment = c(ORCID = "0000-0002-9949-3348")), + person("Daniel", "Nüst", role = c("aut", "cph"), email = "daniel.nuest@uni-muenster.de", comment = c(ORCID = "0000-0002-0024-5046")) + ) Description: A suite of custom R Markdown formats and templates for authoring journal articles and conference submissions. License: GPL-3 diff --git a/NEWS b/NEWS index 8214343a6..ed881e5e2 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ rticles 0.6 (unreleased) - Added the template for the SAGE Journals (thanks, @oguzhanogreden, #181). +- Added the template for Copernicus Publications journals (thanks, @nuest, #172). + rticles 0.5 --------------------------------------------------------------------- diff --git a/R/copernicus_article.R b/R/copernicus_article.R index 275b13522..d731dbada 100644 --- a/R/copernicus_article.R +++ b/R/copernicus_article.R @@ -7,6 +7,7 @@ #' @param base_format The function to use for the base format of the article. #' By default, this is \code{rmarkdown::pdf_document}, but to use bookdown's #' cross-referencing feature, this can be set to \code{bookdown::pdf_document2} +#' @param journal_name A regular expression to filter the by the journal name, see \code{pattern} in \code{\link[base]{grep}}; defaults to \code{*}. #' #' @return R Markdown output format to pass to #' \code{\link[rmarkdown:render]{render}} @@ -18,6 +19,8 @@ #' #' \strong{Version:} Based on copernicus_package.zip in the version 5.0, 21 March 2018, using \code{copernicus.cls} in version 8.67, 30 January 2018 #' +#' \strong{Copernicus journal abbreviations:} You can use the function \code{copernicus_journal_abbreviations()} to get the journal abbreviation for all journals supported by the copernicus article template. +#' #' \strong{Important note:} The online guidelines by Copernicus are the official resource. #' Copernicus is not responsible for the community contributions made to support the template in this package. #' Copenicus converts all typeset TeX files into XML, the expressions and markups have to be highly standardized. @@ -41,7 +44,8 @@ #' \url{https://publications.copernicus.org/for_authors/manuscript_preparation.html} #' #' @examples -#' +#' names(copernicus_journal_abbreviations()) +#' copernicus_journal_abbreviations(journal_name = "Science Data") #' \dontrun{ #' library("rmarkdown") #' draft("MyArticle.Rmd", template = "copernicus_article", package = "rticles") @@ -57,7 +61,7 @@ copernicus_article <- function(..., "-autolink_bare_uris", # disables automatic links, needed for plain email in \correspondence "-auto_identifiers" # disables \hypertarget commands )) { - if (inherits(base_format, "character")) { + if (is.character(base_format)) { FMT <- eval(parse(text = base_format)) } else { FMT <- match.fun(base_format) @@ -112,18 +116,9 @@ copernicus_journals <- list( "Wind Energy Science" = "wes" ) -#' Copernicus journal abbreviations -#' -#' Get the journal abbreviation for all journals supported by the copernicus article template. -#' -#' @param name A regular expression to filter the by the journal name, see \code{pattern} in \code{\link[base]{grep}}; defaults to \code{*}. -#' -#' @examples -#' names(copernicus_journal_abbreviations()) -#' copernicus_journal_abbreviations(name = "Science Data") -#' +#' @rdname copernicus_article #' @export -copernicus_journal_abbreviations <- function(name = "*") { - journal <- copernicus_journals[grepl(pattern = name, x = names(copernicus_journals), ignore.case = TRUE)] +copernicus_journal_abbreviations <- function(journal_name = "*") { + journal <- copernicus_journals[grepl(pattern = journal_name, x = names(copernicus_journals), ignore.case = TRUE)] return(unlist(journal)) } diff --git a/inst/rmarkdown/templates/copernicus_article/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/copernicus_article/skeleton/skeleton.Rmd index b38fc5295..a7f309901 100755 --- a/inst/rmarkdown/templates/copernicus_article/skeleton/skeleton.Rmd +++ b/inst/rmarkdown/templates/copernicus_article/skeleton/skeleton.Rmd @@ -1,6 +1,6 @@ --- title: Template for preparing your manuscript submission to Copernicus journals using RMarkdown -journal: "`r rticles::copernicus_journal_abbreviations(name = 'communication')`" +journal: "`r rticles::copernicus_journal_abbreviations(journal_name = 'communication')`" author: - given_name: Daniel surname: Nüst diff --git a/man/copernicus_article.Rd b/man/copernicus_article.Rd index 128a64e13..a2e803e82 100644 --- a/man/copernicus_article.Rd +++ b/man/copernicus_article.Rd @@ -2,11 +2,14 @@ % Please edit documentation in R/copernicus_article.R \name{copernicus_article} \alias{copernicus_article} +\alias{copernicus_journal_abbreviations} \title{Copernicus journals format.} \usage{ copernicus_article(..., keep_tex = TRUE, citation_package = "natbib", base_format = rmarkdown::pdf_document, - md_extensions = c("-autolink_bare_uris")) + md_extensions = c("-autolink_bare_uris", "-auto_identifiers")) + +copernicus_journal_abbreviations(journal_name = "*") } \arguments{ \item{...}{Additional arguments to \code{base_format}} @@ -23,6 +26,8 @@ cross-referencing feature, this can be set to \code{bookdown::pdf_document2}} \item{md_extensions}{Markdown extensions to be added or removed from the default definition or R Markdown. See the \code{\link{rmarkdown_format}} for additional details.} + +\item{journal_name}{A regular expression to filter the by the journal name, see \code{pattern} in \code{\link[base]{grep}}; defaults to \code{*}.} } \value{ R Markdown output format to pass to @@ -39,6 +44,8 @@ An number of required and optional manuscript sections, e.g. \code{acknowledgeme \strong{Version:} Based on copernicus_package.zip in the version 5.0, 21 March 2018, using \code{copernicus.cls} in version 8.67, 30 January 2018 +\strong{Copernicus journal abbreviations:} You can use the function \code{copernicus_journal_abbreviations()} to get the journal abbreviation for all journals supported by the copernicus article template. + \strong{Important note:} The online guidelines by Copernicus are the official resource. Copernicus is not responsible for the community contributions made to support the template in this package. Copenicus converts all typeset TeX files into XML, the expressions and markups have to be highly standardized. @@ -59,7 +66,8 @@ Therefore, please keep the following in mind: If you use \code{rmarkdown::pdf_document()}, all internal references (i.e. tables and figures) must use \code{\\ref\{\}} whereas with \code{bookdown::pdf_document2()}, you can additionally use \code{\\@ref()}. } \examples{ - +names(copernicus_journal_abbreviations()) +copernicus_journal_abbreviations(journal_name = "Science Data") \dontrun{ library("rmarkdown") draft("MyArticle.Rmd", template = "copernicus_article", package = "rticles") diff --git a/man/copernicus_journal_abbreviations.Rd b/man/copernicus_journal_abbreviations.Rd deleted file mode 100644 index 4c7933b8a..000000000 --- a/man/copernicus_journal_abbreviations.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/copernicus_article.R -\name{copernicus_journal_abbreviations} -\alias{copernicus_journal_abbreviations} -\title{Copernicus journal abbreviations} -\usage{ -copernicus_journal_abbreviations(name = "*") -} -\arguments{ -\item{name}{A regular expression to filter the by the journal name, see \code{pattern} in \code{\link[base]{grep}}; defaults to \code{*}.} -} -\description{ -Get the journal abbreviation for all journals supported by the copernicus article template. -} -\examples{ -names(copernicus_journal_abbreviations()) -copernicus_journal_abbreviations(name = "Science Data") - -} diff --git a/tests/testit/test-formats.R b/tests/testit/test-formats.R index c143ab95e..e33fbac19 100644 --- a/tests/testit/test-formats.R +++ b/tests/testit/test-formats.R @@ -42,3 +42,4 @@ test_format("peerj_article") test_format("amq_article") test_format("mdpi_article") test_format("mnras_article") +test_format("copernicus_article")