Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export(elsevier_article)
export(frontiers_article)
export(ieee_article)
export(joss_article)
export(journals)
export(jss_article)
export(mdpi_article)
export(mnras_article)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
rticles 0.15
---------------------------------------------------------------------

- Add a new `journals()` function to list all available journal names.

- Template directory in package's `rmarkdown/templates` directory has been renamed from _journalname_article_ to _journalname_. To create a new document using `rmarkdown::draft`, only the _journalname_ should be provided, i.e `rmarkdown::draft("MyArticle.Rmd", template = "rjournal", package = "rticles")`

- Improved the `rjournal_article()` format : `.tex`, `.R`, and PDF files with correct names are generated to match the author's guidelines, two affiliations is now supported for authors, the last author is separated by `and` when multiple authors are present, and the documentation has been improved on the help page `?rticles::rjournal_article` and in the skeleton document (thanks, @RLumSK, #286).
Expand Down
18 changes: 18 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
#' List available journals
#'
#' The function [journals()] will list available journal names in the **rticles**
#' package. These names can be useful in two ways :
#' * You can add `_article` suffix to get the format (i.e [rjournal_article()]).
#' Only exception is for the [ctex()] format.
#' * You can use the name directly in the `template` argument of
#' [rmarkdown::draft()].
#'
#' @return a vector with the journal names of format available in rticles
#' @export
#' @md
#' @examples
#' rticles::journals()
journals <- function() {
sort(dir(pkg_file("rmarkdown", "templates")))
}

find_resource <- function(template, file = 'template.tex') {
res <- pkg_file("rmarkdown", "templates", template, "resources", file)
if (res == "") stop(
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Currently included templates and their contributors are the following:
| [The R Journal](https://journal.r-project.org/) | | | `rjournal_article()` |


You can also get the list of available journal names with `rticles::journals()`.

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/).

Using **rticles** requires the prerequisites described below. You can get most of these automatically by installing the latest release of RStudio (instructions for using **rticles** without RStudio are also provided).
Expand Down
24 changes: 24 additions & 0 deletions man/journals.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions tests/testit/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ assert("last author is prepend with and ", {
unmodified <- c("\\author{John, Bob}", "some text", "\\author{Mary, Dany}")
(suppressWarnings(post_process_authors(unmodified)) %==% unmodified)
})

assert("all journals are listed and have a template folder", {
all <- grep("_article$|ctex", getNamespaceExports("rticles"), value = TRUE)
all <- gsub("_article$", "", all)
journals() %==% sort(all)
})