-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Copernicus Publications template #172
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1278161
add copernicus template
nuest edaaa5d
update PR, see comment in #172
nuest 3a75330
remove standard packages from template folder
nuest 428b2bd
updated name for Copernicus
nuest 2b46daa
Merge branch 'master' into copernicus
nuest f4bd63d
revert changes in .gitignore
yihui File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
.Rhistory | ||
.RData | ||
|
||
|
||
MyArticle/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
inst/rmarkdown/templates/copernicus_article/resources/README_copernicus_package_5_0.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd merge the doc of this function with
copernicus_article
, i.e.#' @rdname copernicus_article
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.