Skip to content

Commit

Permalink
Add Copernicus Publications template (#172)
Browse files Browse the repository at this point in the history
* add copernicus template

(squashed changes)

- update to template package version 5.0
- appendix may not be loaded via external file, use yaml property instead
- add hints for additional metadata
- add default language for babel
- add default language for babel
- fix tightlist in pandoc
- no HTML comments with LaTeX in it
- update docs
- clarify usage of quations, closes #1
- clarify docs for algorithm packages
- add examples for usage of \unit{}

* update PR, see comment in #172

* remove standard packages from template folder

* updated name for Copernicus

to not confuse Copernicus Publicatoins with "Copernicus Publishers"
 (https://flakyj.blogspot.com/2018/03/copernicus-publishers.html)

* revert changes in .gitignore
  • Loading branch information
nuest authored and yihui committed Sep 20, 2018
1 parent 1269fce commit b5da792
Show file tree
Hide file tree
Showing 18 changed files with 7,113 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
.Rproj.user
.Rhistory
.RData

3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ 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("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.
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export(aea_article)
export(amq_article)
export(ams_article)
export(asa_article)
export(copernicus_article)
export(copernicus_journal_abbreviations)
export(ctex)
export(ctex_template)
export(elsevier_article)
Expand Down
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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).

- Supports syntax highlighting in the `ieee_article()` and `acm_article()` formats (thanks, @rainer-rq-koelle, #182).

rticles 0.5
Expand Down
124 changes: 124 additions & 0 deletions R/copernicus_article.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#' Copernicus journals format.
#'
#' Format for creating submissions to Copernicus journals.
#'
#' @inheritParams rmarkdown::pdf_document
#' @param ... Additional arguments to \code{base_format}
#' @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}}
#'
#' @details This was adapted from
#' \href{https://publications.copernicus.org/for_authors/manuscript_preparation.html}{https://publications.copernicus.org/for_authors/manuscript_preparation.html}.
#'
#' 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.
#'
#' \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.
#' Therefore, please keep the following in mind:
#'
#' \itemize{
#' \item Please provide only one figure file for figures with several panels, and please do not use \code{\\subfloat} or similar commands.
#' \item Please use only commands in which words, numbers, etc. are within braces (e.g. \code{\\textrm{TEXT}} instead of \code{{\\rm TEXT}}).
#' \item For algorithms, please use the syntax given in template.tex or provide your algorithm as a figure.
#' \item Please do not define new commands.
#' \item The most commonly used packages (\code{\\usepackage{}}) are integrated in the copernicus.cls. Some other packages often used by the community are defined in template.tex. Please do not insert additional ones in your *.tex file.
#' \item Spaces in labels (\code{\\label{}}) are not allowed; please make sure that no label name is assigned more than once.
#' \item Please do not use \code{\\paragraph{}}; only \code{\\subsubsection{}} is allowed.
#' \item It is not possible to add tables in colour.
#' }
#'
#' @note 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()}.
#'
#' @references
#' Manuscript preparation guidelines for authors.
#' \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")
#' render("MyArticle/MyArticle.Rmd")
#' }
#'
#' @export
copernicus_article <- function(...,
keep_tex = TRUE,
citation_package = "natbib",
base_format = rmarkdown::pdf_document,
md_extensions = c(
"-autolink_bare_uris", # disables automatic links, needed for plain email in \correspondence
"-auto_identifiers" # disables \hypertarget commands
)) {
if (is.character(base_format)) {
FMT <- eval(parse(text = base_format))
} else {
FMT <- match.fun(base_format)
}
FMT(...,
citation_package = citation_package,
keep_tex = keep_tex,
md_extensions = md_extensions,
template = find_resource("copernicus_article", "template.tex"))
}

# quick dev shortcut for Ubuntu: click "Install and restart" then run:
# unlink("MyArticle/", recursive = TRUE); draft("MyArticle.Rmd", template = "copernicus_article", package = "rticles", edit = FALSE); render("MyArticle/MyArticle.Rmd"); system(paste0("gnome-open ", here::here("MyArticle", "MyArticle.pdf")))

copernicus_journals <- list(
"Advances in Geosciences" = "adgeo",
"Advances in Radio Science" = "ars",
"Advances in Science and Research" = "asr",
"Advances in Statistical Climatology, Meteorology and Oceanography" = "ascmo",
"Annales Geophysicae" = "angeo",
"Archives Animal Breeding" = "aab",
"ASTRA Proceedings" = "ap",
"Atmospheric Chemistry and Physics" = "acp",
"Atmospheric Measurement Techniques" = "amt",
"Biogeosciences" = "bg",
"Climate of the Past" = "cp",
"Drinking Water Engineering and Science" = "dwes",
"Earth Surface Dynamics" = "esurf",
"Earth System Dynamics" = "esd",
"Earth System Science Data" = "essd",
"E&G Quaternary Science Journal" = "egqsj",
"Fossil Record" = "fr",
"Geographica Helvetica" = "gh",
"Geoscience Communication" = "gc",
"Geoscientific Instrumentation, Methods and Data Systems" = "gi",
"Geoscientific Model Development" = "gmd",
"History of Geo- and Space Sciences" = "hgss",
"Hydrology and Earth System Sciences" = "hess",
"Journal of Micropalaeontology" = "jm",
"Journal of Sensors and Sensor Systems" = "jsss",
"Mechanical Sciences" = "ms",
"Natural Hazards and Earth System Sciences" = "nhess",
"Nonlinear Processes in Geophysics" = "npg",
"Ocean Science" = "os",
"Primate Biology" = "pb",
"Proceedings of the International Association of Hydrological Sciences" = "piahs",
"Scientific Drilling" = "sd",
"SOIL" = "soil",
"Solid Earth" = "se",
"The Cryosphere" = "tc",
"Web Ecology" = "we",
"Wind Energy Science" = "wes"
)

#' @rdname copernicus_article
#' @export
copernicus_journal_abbreviations <- function(journal_name = "*") {
journal <- copernicus_journals[grepl(pattern = journal_name, x = names(copernicus_journals), ignore.case = TRUE)]
return(unlist(journal))
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ The **rticles** package provides a suite of custom [R Markdown](http://rmarkdown

- [Statistics in Medicine](http://onlinelibrary.wiley.com/journal/10.1002/(ISSN)1097-0258/homepage/la_tex_class_file.htm) journal submissions

- [Copernicus Publications](https://publications.copernicus.org) journal submissions

- [The R Journal](https://journal.r-project.org/) articles

Under the hood, LaTeX templates are used to ensure that documents conform precisely to submission standards. At the same time, composition and formatting can be done using lightweight [markdown](https://rmarkdown.rstudio.com/authoring_basics.html) syntax, and R code and its output can be seamlessly included using [knitr](https://yihui.name/knitr/).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
File: README_copernicus_package_5_0.txt
-------------------------------------------------------------------------
This is a README file for the Copernicus Publications LaTeX Macro Package
copernicus_package.zip in the version 5.0, 21 March 2018
-------------------------------------------------------------------------
It consists of several files, each with its separate copyright.
This specific archive is collected for journals published by
Copernicus Publications (Copernicus GmbH).

Copyright (C) 2018 Copernicus GmbH

E-mail: publications@copernicus.org
URL: https://publications.copernicus.org



Content:
- copernicus.cls: The LaTeX2e class file designed for Copernicus Publications journals. Current Version 8.67, 30 January 2018
- copernicus.cfg: The configuration file containing journal-specific information used by the class file. Last update 21 March 2018
- copernicus.bst: The bibliographic style file for BibTeX. Current Version 1.2, September 2017
- natbib.sty
- pdfscreencop.sty / pdfscreen.sty
- template.tex: A LaTeX template in journal style.
Loading

0 comments on commit b5da792

Please sign in to comment.