Skip to content

Commit b5da792

Browse files
nuestyihui
authored andcommitted
Add Copernicus Publications template (#172)
* 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
1 parent 1269fce commit b5da792

18 files changed

+7113
-2
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
.Rproj.user
33
.Rhistory
44
.RData
5-

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ Authors@R: c(
2727
person("Marc-Andre", "Desautels", role = c("aut", "cph"), email = "[email protected]"),
2828
person("Dominik", "Leutnant", role = c("aut", "cph"), email = "[email protected]"),
2929
person(family = "MDPI", role = c("aut", "cph")),
30-
person("Oğuzhan", "Öğreden", role = c("aut"), comment = c(ORCID = "0000-0002-9949-3348"))
30+
person("Oğuzhan", "Öğreden", role = c("aut"), comment = c(ORCID = "0000-0002-9949-3348")),
31+
person("Daniel", "Nüst", role = c("aut", "cph"), email = "[email protected]", comment = c(ORCID = "0000-0002-0024-5046"))
3132
)
3233
Description: A suite of custom R Markdown formats and templates for
3334
authoring journal articles and conference submissions.

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export(aea_article)
66
export(amq_article)
77
export(ams_article)
88
export(asa_article)
9+
export(copernicus_article)
10+
export(copernicus_journal_abbreviations)
911
export(ctex)
1012
export(ctex_template)
1113
export(elsevier_article)

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ rticles 0.6 (unreleased)
33

44
- Added the template for the SAGE Journals (thanks, @oguzhanogreden, #181).
55

6+
- Added the template for Copernicus Publications journals (thanks, @nuest, #172).
7+
68
- Supports syntax highlighting in the `ieee_article()` and `acm_article()` formats (thanks, @rainer-rq-koelle, #182).
79

810
rticles 0.5

R/copernicus_article.R

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#' Copernicus journals format.
2+
#'
3+
#' Format for creating submissions to Copernicus journals.
4+
#'
5+
#' @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+
#' @param journal_name A regular expression to filter the by the journal name, see \code{pattern} in \code{\link[base]{grep}}; defaults to \code{*}.
11+
#'
12+
#' @return R Markdown output format to pass to
13+
#' \code{\link[rmarkdown:render]{render}}
14+
#'
15+
#' @details This was adapted from
16+
#' \href{https://publications.copernicus.org/for_authors/manuscript_preparation.html}{https://publications.copernicus.org/for_authors/manuscript_preparation.html}.
17+
#'
18+
#' 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.
19+
#'
20+
#' \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
21+
#'
22+
#' \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.
23+
#'
24+
#' \strong{Important note:} The online guidelines by Copernicus are the official resource.
25+
#' Copernicus is not responsible for the community contributions made to support the template in this package.
26+
#' Copenicus converts all typeset TeX files into XML, the expressions and markups have to be highly standardized.
27+
#' Therefore, please keep the following in mind:
28+
#'
29+
#' \itemize{
30+
#' \item Please provide only one figure file for figures with several panels, and please do not use \code{\\subfloat} or similar commands.
31+
#' \item Please use only commands in which words, numbers, etc. are within braces (e.g. \code{\\textrm{TEXT}} instead of \code{{\\rm TEXT}}).
32+
#' \item For algorithms, please use the syntax given in template.tex or provide your algorithm as a figure.
33+
#' \item Please do not define new commands.
34+
#' \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.
35+
#' \item Spaces in labels (\code{\\label{}}) are not allowed; please make sure that no label name is assigned more than once.
36+
#' \item Please do not use \code{\\paragraph{}}; only \code{\\subsubsection{}} is allowed.
37+
#' \item It is not possible to add tables in colour.
38+
#' }
39+
#'
40+
#' @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()}.
41+
#'
42+
#' @references
43+
#' Manuscript preparation guidelines for authors.
44+
#' \url{https://publications.copernicus.org/for_authors/manuscript_preparation.html}
45+
#'
46+
#' @examples
47+
#' names(copernicus_journal_abbreviations())
48+
#' copernicus_journal_abbreviations(journal_name = "Science Data")
49+
#' \dontrun{
50+
#' library("rmarkdown")
51+
#' draft("MyArticle.Rmd", template = "copernicus_article", package = "rticles")
52+
#' render("MyArticle/MyArticle.Rmd")
53+
#' }
54+
#'
55+
#' @export
56+
copernicus_article <- function(...,
57+
keep_tex = TRUE,
58+
citation_package = "natbib",
59+
base_format = rmarkdown::pdf_document,
60+
md_extensions = c(
61+
"-autolink_bare_uris", # disables automatic links, needed for plain email in \correspondence
62+
"-auto_identifiers" # disables \hypertarget commands
63+
)) {
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"))
74+
}
75+
76+
# quick dev shortcut for Ubuntu: click "Install and restart" then run:
77+
# 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")))
78+
79+
copernicus_journals <- list(
80+
"Advances in Geosciences" = "adgeo",
81+
"Advances in Radio Science" = "ars",
82+
"Advances in Science and Research" = "asr",
83+
"Advances in Statistical Climatology, Meteorology and Oceanography" = "ascmo",
84+
"Annales Geophysicae" = "angeo",
85+
"Archives Animal Breeding" = "aab",
86+
"ASTRA Proceedings" = "ap",
87+
"Atmospheric Chemistry and Physics" = "acp",
88+
"Atmospheric Measurement Techniques" = "amt",
89+
"Biogeosciences" = "bg",
90+
"Climate of the Past" = "cp",
91+
"Drinking Water Engineering and Science" = "dwes",
92+
"Earth Surface Dynamics" = "esurf",
93+
"Earth System Dynamics" = "esd",
94+
"Earth System Science Data" = "essd",
95+
"E&G Quaternary Science Journal" = "egqsj",
96+
"Fossil Record" = "fr",
97+
"Geographica Helvetica" = "gh",
98+
"Geoscience Communication" = "gc",
99+
"Geoscientific Instrumentation, Methods and Data Systems" = "gi",
100+
"Geoscientific Model Development" = "gmd",
101+
"History of Geo- and Space Sciences" = "hgss",
102+
"Hydrology and Earth System Sciences" = "hess",
103+
"Journal of Micropalaeontology" = "jm",
104+
"Journal of Sensors and Sensor Systems" = "jsss",
105+
"Mechanical Sciences" = "ms",
106+
"Natural Hazards and Earth System Sciences" = "nhess",
107+
"Nonlinear Processes in Geophysics" = "npg",
108+
"Ocean Science" = "os",
109+
"Primate Biology" = "pb",
110+
"Proceedings of the International Association of Hydrological Sciences" = "piahs",
111+
"Scientific Drilling" = "sd",
112+
"SOIL" = "soil",
113+
"Solid Earth" = "se",
114+
"The Cryosphere" = "tc",
115+
"Web Ecology" = "we",
116+
"Wind Energy Science" = "wes"
117+
)
118+
119+
#' @rdname copernicus_article
120+
#' @export
121+
copernicus_journal_abbreviations <- function(journal_name = "*") {
122+
journal <- copernicus_journals[grepl(pattern = journal_name, x = names(copernicus_journals), ignore.case = TRUE)]
123+
return(unlist(journal))
124+
}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ The **rticles** package provides a suite of custom [R Markdown](http://rmarkdown
5252

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

55+
- [Copernicus Publications](https://publications.copernicus.org) journal submissions
56+
5557
- [The R Journal](https://journal.r-project.org/) articles
5658

5759
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/).
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
File: README_copernicus_package_5_0.txt
2+
-------------------------------------------------------------------------
3+
This is a README file for the Copernicus Publications LaTeX Macro Package
4+
copernicus_package.zip in the version 5.0, 21 March 2018
5+
-------------------------------------------------------------------------
6+
It consists of several files, each with its separate copyright.
7+
This specific archive is collected for journals published by
8+
Copernicus Publications (Copernicus GmbH).
9+
10+
Copyright (C) 2018 Copernicus GmbH
11+
12+
13+
URL: https://publications.copernicus.org
14+
15+
16+
17+
Content:
18+
- copernicus.cls: The LaTeX2e class file designed for Copernicus Publications journals. Current Version 8.67, 30 January 2018
19+
- copernicus.cfg: The configuration file containing journal-specific information used by the class file. Last update 21 March 2018
20+
- copernicus.bst: The bibliographic style file for BibTeX. Current Version 1.2, September 2017
21+
- natbib.sty
22+
- pdfscreencop.sty / pdfscreen.sty
23+
- template.tex: A LaTeX template in journal style.

0 commit comments

Comments
 (0)