Skip to content

Commit

Permalink
Updates springer article (#494)
Browse files Browse the repository at this point in the history
Co-authored-by: Christophe Dervieux <christophe.dervieux@gmail.com>
  • Loading branch information
eliocamp and cderv authored May 11, 2023
1 parent 1321cc2 commit 6cb647e
Show file tree
Hide file tree
Showing 18 changed files with 16,795 additions and 1,718 deletions.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@

- `rjournal_article()` is now soft deprecated in favor of `rjtools::rjournal_pdf_article()` as **rjtools** package is now the recommended workflow at <https://rjournal.github.io/submissions.html>. A warning will be thrown when rticles' function is used.

- `springer_article()` has been updated to new LaTeX templates and CTAN package (thanks, @eliocamp, #494). **we really advice to start new article from scratch by creating new document using lates RMakrdown template**. Among changes:
- New `.tex` templates derived from [https://www.springernature.com](https://www.springernature.com/gp/authors/campaigns/latex-author-support) using `sn-jnl.cls`
- In the format function, `natbib` is now the default citation processing package used (previous it was pandoc citeproc) and `number_sections` is TRUE by default now. Set to `FALSE` for unnumbered headers.
- In the YAML header options, `biblio-style` is now ignored as references styling happens with document class option, so using `classoptions` is now required. `PACS` and `MSC` is also ignored in favor of `pacs.jel` and `pacs.msc`.
- The whole authors and affiliation fields has been rewritten - please see template for new format.
- Pandoc 2.11.4 and above is now required for this format.

## NEW FEATURES

- `ieee_article()` now supports several affiliations per `authors` when using the `wide: true` mode (thanks, @phamdn, #500).
Expand Down
61 changes: 57 additions & 4 deletions R/article.R
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,65 @@ sim_article <- function(..., highlight = NULL, citation_package = "natbib") {
#' Macro package for Springer Journals.
#' @export
#' @rdname article
springer_article <- function(..., keep_tex = TRUE,
citation_package = "default") {
pdf_document_format(
springer_article <- function(..., keep_tex = TRUE, citation_package = "natbib",
number_sections = TRUE, latex_engine = "pdflatex",
pandoc_args = NULL) {

if (!rmarkdown::pandoc_available("2.11.4")) {
stop("`springer_article()` now requires a minimum of pandoc 2.11.4")
}

if (citation_package == "biblatex") {
stop("'springer_article' does not support `biblatex` for citation processing. Use 'natbib' instead.")
}

# to compile with pdflatex/xelatex
# use pdflatex option in the pandoc's template for the document class
if(latex_engine %in% c("pdflatex", "xelatex")) {
pandoc_args <- c(pandoc_args, rmarkdown::pandoc_variable_arg("pdflatex"))
}

if(!number_sections) {
pandoc_args <- c(pandoc_args, rmarkdown::pandoc_variable_arg("unnumbered"))
}

format <- pdf_document_format(
"springer",
keep_tex = keep_tex, citation_package = citation_package, ...
keep_tex = keep_tex,
citation_package = citation_package,
number_sections = number_sections,
latex_engine = latex_engine,
pandoc_args = pandoc_args, ...
)

pre_knit_fun <- format$pre_knit
format$pre_knit <- function(input, ...) {
if (is.function(pre_knit_fun)) pre_knit_fun(input, ...)
# for backward compatibility as we changed the template in
# https://github.com/rstudio/rticles/pull/494
options <- rmarkdown::yaml_front_matter(input)
new_template_msg <- c("If you are rendering an old Rmd, be advise that the template has changed in version '0.25'\n",
" and you should start from a fresh template to get latest resources and new YAML header format.")
if (is.null(options[["classoptions"]])) {
stop("`springer_article()` now requires the 'classoptions' field in YAML front matter. ",
new_template_msg, call. = FALSE)
}
if (!is.null(options[["biblio-style"]])) {
warning("`springer_article()` now ignores the 'biblio-style' field in YAML front matter. ",
"Reference style for 'natbib' is now set using the 'classoptions' field.\n",
new_template_msg)
}
if (!is.null(options[["PACS"]])) {
warning("`springer_article()` now ignores the 'PACS' field in YAML front matter to use `pacs.jel` and `pacs.msc`. ",
new_template_msg)
}
if (!is.null(options[["authors"]][["name"]])) {
stop("`springer_article()` now uses different authors and affiliations fields.\n",
new_template_msg, call. = FALSE)
}
return(invisible(NULL))
}
format
}

#' @section `tf_article`: Format for creating submissions to a Taylor & Francis journal. Adapted from
Expand Down
173 changes: 93 additions & 80 deletions inst/rmarkdown/templates/springer/resources/template.tex
Original file line number Diff line number Diff line change
@@ -1,32 +1,61 @@
% !TeX program = pdfLaTeX
\documentclass[smallextended]{svjour3} % onecolumn (second format)
%\documentclass[twocolumn]{svjour3} % twocolumn
%Version 2.1 April 2023
% See section 11 of the User Manual for version history
%
\smartqed % flush right qed marks, e.g. at end of proof
%
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% Please do not use \input{...} to include other tex files. %%
%% Submit your LaTeX manuscript as one .tex document. %%
%% %%
%% All additional figures and files should be attached %%
%% separately and not embedded in the \TeX\ document itself. %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[$for(classoptions)$$classoptions$$sep$,$endfor$$if(pdflatex)$,pdflatex$endif$]{sn-jnl}

%%%% Standard Packages
%%<additional latex packages if required can be included here>

\usepackage{graphicx}%
\usepackage{multirow}%
\usepackage{amsmath,amssymb,amsfonts}%
\usepackage{amsthm}%
\usepackage{mathrsfs}%
\usepackage[title]{appendix}%
\usepackage{xcolor}%
\usepackage{textcomp}%
\usepackage{manyfoot}%
\usepackage{booktabs}%
\usepackage{algorithm}%
\usepackage{algorithmicx}%
\usepackage{algpseudocode}%
\usepackage{listings}%
%%%%

%%%%%=============================================================================%%%%
%%%% Remarks: This template is provided to aid authors with the preparation
%%%% of original research articles intended for submission to journals published
%%%% by Springer Nature. The guidance has been prepared in partnership with
%%%% production teams to conform to Springer Nature technical requirements.
%%%% Editorial and presentation requirements differ among journal portfolios and
%%%% research disciplines. You may find sections in this template are irrelevant
%%%% to your work and are empowered to omit any such section if allowed by the
%%%% journal you intend to submit to. The submission guidelines and policies
%%%% of the journal take precedence. A detailed User Manual is available in the
%%%% template package for technical guidance.
%%%%%=============================================================================%%%%

\usepackage[hyphens]{url} % not crucial - just used below for the URL
\usepackage{hyperref}
$for(header-includes)$
$header-includes$
$endfor$

%
% \usepackage{mathptmx} % use Times fonts if available on your TeX system
%
% insert here the call for the packages your document requires
%\usepackage{latexsym}
% etc.
%
% please place your own definitions here and don't use \def but
% \newcommand{}{}
%
% Insert the name of "your journal" with
% \journalname{myjournal}
%

%% load any required packages here
$preamble$
\raggedbottom

$if(unnumbered)$
\unnumbered
$endif$


$if(highlighting-macros)$
% Pandoc syntax highlighting
Expand Down Expand Up @@ -87,81 +116,65 @@
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$

$for(header-includes)$
$header-includes$
$endfor$


\begin{document}

$for(include-before)$
$include-before$

$endfor$

\title{$title$ $if(thanks)$\thanks{$thanks$} $endif$}
$if(subtitle)$ \subtitle{$subtitle$} $endif$

$if(titlerunning)$
\titlerunning{$titlerunning$}
$endif$

\author{ $for(authors)$ $authors.name$ \and $endfor$ }
\title[$if(titlerunning)$$titlerunning$$endif$]{$title$}

%%=============================================================%%
%% Prefix -> \pfx{Dr}
%% GivenName -> \fnm{Joergen W.}
%% Particle -> \spfx{van der} -> surname prefix
%% FamilyName -> \sur{Ploeg}
%% Suffix -> \sfx{IV}
%% NatureName -> \tanm{Poet Laureate} -> Title after name
%% Degrees -> \dgr{MSc, PhD}
%% \author*[1,2]{\pfx{Dr} \fnm{Joergen W.} \spfx{van der} \sur{Ploeg} \sfx{IV} \tanm{Poet Laureate}
%% \dgr{MSc, PhD}}\email{iauthor@gmail.com}
%%=============================================================%%

$for(authors)$
\author$if(authors.corresponding)$*$endif$[$for(authors.affiliation)$$authors.affiliation$$sep$,$endfor$]{$if(authors.prefix)$\pfx{$authors.prefix$} $endif$$if(authors.firstname)$\fnm{$authors.firstname$} $endif$$if(authors.particle)$\spfx{$authors.particle$} $endif$$if(authors.lastname)$\sur{$authors.lastname$} $endif$$if(authors.suffix)$\sfx{$authors.suffix$} $endif$$if(authors.naturename)$\tanm{$authors.naturename$} $endif$$if(authors.degrees)$\dgr{$authors.degrees$}$endif$}$if(authors.email)$\email{$authors.email$}$endif$
$if(authors.equal_contribution)$\equalcont{authors.equal_contribution}$endif$
$endfor$

$if(authorrunning)$
\authorrunning{ $authorrunning$ }
$endif$

\institute{
$for(authors)$
$authors.name$ \at
$if(authors.address)$ $authors.address$ $endif$\\
$if(authors.email)$ \email{$authors.email$} $endif$ % \\
% \emph{Present address:} of F. Author % if needed
\and
$endfor$
}
$for(affiliations)$
\affil$if(affiliations.corresponding)$*$endif$[$affiliations.number$]{$for(affiliations.info/pairs)$\$it.key${$it.value$}$sep$, $endfor$$if(affiliations.address)$, \orgaddress{$for(affiliations.address/pairs)$\$it.key${$it.value$}$sep$, $endfor$}$endif$}
$endfor$
\date{Received: date / Accepted: date}
% The correct dates will be entered by the editor
\abstract{$abstract$}
\keywords{$for(keywords)$$keywords$$sep$, $endfor$}
\maketitle
\begin{abstract}
$abstract$
\\
\keywords{
$for(keywords)$
$keywords$ \and
$endfor$
}
$if(PACS)$
\PACS{
$for(PACS)$
$PACS$ \and
$endfor$
}
$if(pacs)$
$if(pacs.jel)$
\pacs[JEL Classification]{$for(pacs.jel)$$pacs.jel$$sep$, $endfor$}
$endif$
$if(pacs.msc)$
\pacs[MSC Classification]{$for(pacs.msc)$$pacs.msc$$sep$, $endfor$}
$endif$

$if(MSC)$
\subclass{
$for(MSC)$
$MSC$ \and
$endfor$
}
$endif$
\end{abstract}


\def\spacingset#1{\renewcommand{\baselinestretch}%
{#1}\small\normalsize} \spacingset{1}

\maketitle
$body$

\bibliographystyle{$if(biblio-style)$$biblio-style$$else$$if(bibstyle)$$bibstyle$$else$spbasic$endif$$endif$}
$if(natbib)$
$if(bibliography)$
$if(biblio-title)$
\renewcommand\refname{$biblio-title$}
$endif$
\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
$endif$
$endif$
$for(include-after)$
$include-after$
Expand Down
42 changes: 20 additions & 22 deletions inst/rmarkdown/templates/springer/skeleton/bibliography.bib
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
%% Copied from asa_article template
%% Journal article
@article{bib1,
author = "Campbell, S. L. and Gear, C. W.",
title = "The index of general nonlinear {D}{A}{E}{S}",
journal = "Numer. {M}ath.",
volume = "72",
number = "2",
pages = "173--196",
year = "1995"
}

@incollection{Galyardt14mmm,
Author = {April Galyardt},
Booktitle = {Handbook of Mixed Membership Models},
Date-Added = {2014-08-21 21:18:27 +0000},
Date-Modified = {2014-08-21 21:18:27 +0000},
Editor = {Edoardo M. Airoldi and David Blei and Erosheva, Elena and Fienberg, Stephen E.},
Publisher = {Chapman and Hall},
Title = {Interpreting Mixed Membership Models: Implications of Erosheva's Representation Theorem},
Year = {2014}
%% Journal article with DOI
@article{bib2,
author = "Slifka, M. K. and Whitton, J. L.",
title = "Clinical implications of dysregulated cytokine production",
journal = "J. {M}ol. {M}ed.",
volume = "78",
pages = "74--80",
year = "2000",
doi = "10.1007/s001090000086"
}


@incollection{Mislevy06Cog,
Author = {Robert Mislevy},
Booktitle = {Educational Assessment},
Chapter = {8},
Date-Added = {2014-08-21 20:58:59 +0000},
Date-Modified = {2014-08-21 20:58:59 +0000},
Editor = {Robert L. Brennan},
Publisher = {American Council on Education and Praeger Publishers},
Title = {Cognitive Psychology and Educational Assessment},
Year = {2006}
}

Loading

0 comments on commit 6cb647e

Please sign in to comment.