|
| 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 | +} |
0 commit comments