Skip to content

Update to elsevier template #467

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

Merged
merged 17 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from 9 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
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

- Update Copernicus Publications template to version 6.6 from 2022-01-18 (@RLumSK, #463, #464)

- Update Elsevier template to version 3.3. (thanks, @robjhyndman, #467)

# rticles 0.22

## BREAKING CHANGE
Expand Down
14 changes: 12 additions & 2 deletions R/article.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,23 @@ ctex <- ctex_article
#' @section `elsevier_article`: Format for creating submissions to Elsevier
#' journals. Adapted from
#' <https://www.elsevier.com/authors/policies-and-guidelines/latex-instructions>.
#'
#' It requires a minimum version of 2.10 for Pandoc.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to think about this. I don't mind doing that for new articles formats, but elsevier_article() is not a new function. Adding this requirement will make this a breaking change. They would need to have a newer Pandoc. Version 2.10 is not that old "2020-06-29" and even if RStudio is shipping with recent version, there could be some users still using an older Pandoc.

#' @export
#' @rdname article
elsevier_article <- function(
..., keep_tex = TRUE, md_extensions = c("-autolink_bare_uris")
..., keep_tex = TRUE, md_extensions = c("-autolink_bare_uris"),
citation_package = "natbib"
) {
if (citation_package == "biblatex") {
stop("Elsevier template does not support `biblatex` for citation processing.")
}
if (!rmarkdown::pandoc_available("2.10")) {
stop("informs_article requires a minimum of pandoc 2.10.")
}
pdf_document_format(
"elsevier", keep_tex = keep_tex, md_extensions = md_extensions, ...
"elsevier", keep_tex = keep_tex, md_extensions = md_extensions,
citation_package = citation_package, ...
)
}

Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Currently included templates and their contributors are the following:
| [Bulletin de l'AMQ](https://www.amq.math.ca/bulletin/)| [\@desautm](https://github.com/desautm)| [\#145](https://github.com/rstudio/rticles/pull/145) | `amq_article()`|
| [Copernicus Publications](https://publications.copernicus.org)| [\@nuest](https://github.com/nuest), [\@RLumSK](https://github.com/RLumSK) | [\#172](https://github.com/rstudio/rticles/pull/172), [\#342](https://github.com/rstudio/rticles/pull/342) | `copernicus_article()` |
| [CTeX](https://ctan.org/pkg/ctex) ||| `ctex()` |
| [Elsevier](https://www.elsevier.com)| [\@cboettig](https://github.com/cboettig)| [\#27](https://github.com/rstudio/rticles/pull/27) | `elsevier_article()` |
| [Elsevier](https://www.elsevier.com)| [\@cboettig](https://github.com/cboettig), [\@robjhyndman](https://github.com/robjhyndman) | [\#27](https://github.com/rstudio/rticles/pull/27), [\#467](https://github.com/rstudio/rticles/pull/467) | `elsevier_article()` |
| [Frontiers](https://www.frontiersin.org/) | [\@muschellij2](https://github.com/muschellij2)| [\#211](https://github.com/rstudio/rticles/pull/211) | `frontiers_article()`|
| [Glossa](https://www.glossa-journal.org) | [\@stefanocoretta](https://github.com/stefanocoretta) | [#361](https://github.com/rstudio/rticles/pull/361) | `glossa_article()` |
| [IEEE Transaction](http://www.ieee.org/publications_standards/publications/authors/author_templates.html) | [\@Emaasit](https://github.com/Emaasit), [\@espinielli](https://github.com/espinielli), [\@nathanweeks](https://github.com/nathanweeks), [\@DunLug](https://github.com/DunLug) | [\#97](https://github.com/rstudio/rticles/pull/97), [\#169](https://github.com/rstudio/rticles/pull/169), [\#227](https://github.com/rstudio/rticles/pull/227), [\#263](https://github.com/rstudio/rticles/pull/263), [\#264](https://github.com/rstudio/rticles/pull/264), [\#265](https://github.com/rstudio/rticles/pull/265) | `ieee_article()` |
Expand Down
88 changes: 44 additions & 44 deletions README.md

Large diffs are not rendered by default.

29 changes: 19 additions & 10 deletions inst/rmarkdown/templates/elsevier/resources/template.tex
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
\documentclass[$layout$]{elsarticle} %review=doublespace preprint=single 5p=2 column
$-- Keeping in template layout for backward compatibility

\documentclass[$if(layout)$$layout$$else$$for(classoption)$$classoption$$sep$,$endfor$$endif$]{elsarticle} %review=doublespace preprint=single 5p=2 column
%%% Begin My package additions %%%%%%%%%%%%%%%%%%%

\usepackage[hyphens]{url}

$if(journal)$
\journal{$journal$} % Sets Journal name
$endif$


\usepackage{lineno} % add
$if(linenumbers)$
\linenumbers % turns line numbering on
Expand Down Expand Up @@ -53,11 +55,10 @@
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
$endif$
$if(natbib)$
\usepackage{natbib}
\usepackage[$natbiboptions$]{natbib}
\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
$else$
\bibliographystyle{elsarticle-harv}
$endif$

$if(listings)$
\usepackage{listings}
$endif$
Expand Down Expand Up @@ -85,7 +86,6 @@
urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
pdfborder={0 0 0}}
\urlstyle{same} % don't use monospace font for urls
$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
Expand Down Expand Up @@ -194,20 +194,29 @@

\title{$title$}
$for(author)$
\author[$author.affiliation$]{$author.name$$if(author.footnote)$\corref{$author.footnote$}$endif$}
\author[$author.affiliation$]{$author.name$$if(author.footnote)$%
$if(author.correspondingauthor)$\corref{cor1}$endif$%
\fnref{$author.footnote$}$endif$}
$if(author.email)$ \ead{$author.email$} $endif$
$endfor$
$for(address)$
\address[$address.code$]{$address.address$}
\affiliation[$address.code$]{$address.address$}
$endfor$
\cortext[cor1]{Corresponding author}
$for(footnote)$
\cortext[$footnote.code$]{$footnote.text$}
\fntext[$footnote.code$]{$footnote.text$}
$endfor$

\begin{abstract}
$abstract$
\end{abstract}
$if(keywords)$ \begin{keyword} $for(keywords)$$keywords$$sep$ $endfor$\end{keyword}$endif$
$if(keywords)$
\begin{keyword}
$for(keywords/allbutlast)$$keywords$ \sep $endfor$
$for(keywords/last)$$keywords$$endfor$
\end{keyword}
$endif$
Comment on lines -210 to +217
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the part where Pandoc 2.10 is required right ?

So that we have keyword1 \sep keyword2 and not keyword1 \sep keyword2 \sep ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's the only place that requires pandoc 2.10. I can't think of another way to do it without the user explicitly adding the \sep separators which is a bit ugly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes this is cleaner, but it brings a pretty recent version of Pandoc as a requirement for this template.
You have concerns about elsarticle.cls being outdated on some Linux distribution and that user won't update. Shouldn't we have the same concerns regarding Pandoc ?

If we consider that rticles users are mainly RStudio users, a pandoc version > 2.10 is available since last release. And next release with upgraded version should be soon. So we can set the minimum requirement and see if someone complain.

Other option would be indeed to have a comment in YAML header to ask user to add \sep at the end of the last keyword, or do that ourself in the format by modifying the metadata before doing conversion with Pandoc.


\end{frontmatter}

$body$
Expand Down
Loading