diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 5949c9ddf..28a11bf87 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -83,6 +83,7 @@ jobs: - name: preinstall some CTAN packages run: | + tlmgr update --self tlmgr install achemso adobemapping ae algorithmicx algorithms ametsoc amscls apacite arphic babel-english babel-french beamer biblatex bookmark caption carlisle changepage charter chemgreek cite cjk cjkpunct cns colortbl courier crop ctablestack ctex datetime dblfloatfix draftwatermark endfloat endnotes enumitem environ epsf epstopdf eso-pic esvect etex-pkg everyhook everypage extsizes fancyhdr fandol floatflt fmtcount fontaxes fonts-tlwg footmisc forarray fp fpl garuda-c90 grfext hyphen-french hyphenat ifmtarg jknapltx kastrup lastpage latex-base-dev lettrine lineno listings logreq luatexbase luatexja ly1 marginnote marvosym mathpazo mathspec mdframed mhchem microtype minifp mnras morefloats moreverb mptopdf multirow needspace newfloat newtx norasi-c90 oberdiek palatino parskip pdfsync pgf placeins platex platex-tools preprint psfrag psnfss ptex ptex-base ptex-fonts ragged2e rsfs seqsplit setspace sidecap soul soulutf8 stix sttools subfigure svn-prov symbol tabto-ltx tcolorbox tex-gyre textcase titlesec totcount translator trimspaces ttfutils ucs uhc ulem units uplatex upquote uptex uptex-base uptex-fonts varwidth vruler wadalab wrapfig xcjk2uni xecjk xifthen xpinyin xstring xypic zapfchan zhmetrics zhmetrics-uptex zhnumber zref - uses: r-lib/actions/setup-r-dependencies@v1 diff --git a/DESCRIPTION b/DESCRIPTION index 395759318..f1b863e60 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: rticles Type: Package Title: Article Formats for R Markdown -Version: 0.22.4 +Version: 0.22.5 Authors@R: c( person("JJ", "Allaire", role = "aut", email = "jj@rstudio.com"), person("Yihui", "Xie", role = c("aut"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), diff --git a/NEWS.md b/NEWS.md index b631bd713..6b720990e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # rticles 0.23 (development version) +## BREAKING CHANGE + +- Update Elsevier template and of `elsarticle.cls` to version 3.3 in `elsevier_article()`. This is a breaking change in the format that now **requires at least Pandoc 2.10** and uses the latest version of the `.cls` file, also provided in [elsarticle](https://ctan.org/pkg/elsarticle) on CTAN. See the included template for this format. Also, `natbib` is now used y default for citation processing. You can use [**renv**](https://pkgs.rstudio.com/renv/) to manage your project in locked environment of packages (thanks, @robjhyndman, #467). + ## NEW FEATURES - Update `jss_article()` template to handle ORCID links for each author from a new YAML field, and to use updated `jss.cls` class file (thanks, @remlapmot, #465). @@ -10,7 +14,7 @@ - New `isba_article()` template for submissions to Bayesian Analysis journal (thanks, @dmi3kno, #461). -- Update Copernicus Publications template to version 6.6 from 2022-01-18 (@RLumSK, #463, #464) +- Update Copernicus Publications template to version 6.6 from 2022-01-18 (@RLumSK, #463, #464). # rticles 0.22 diff --git a/R/article.R b/R/article.R index e717b2ff3..bd316ec5b 100644 --- a/R/article.R +++ b/R/article.R @@ -157,13 +157,23 @@ ctex <- ctex_article #' @section `elsevier_article`: Format for creating submissions to Elsevier #' journals. Adapted from #' . +#' +#' It requires a minimum version of 2.10 for 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("`elsevier_article()` now 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, ... ) } diff --git a/README.Rmd b/README.Rmd index 39cb173bc..3cad9c3d7 100644 --- a/README.Rmd +++ b/README.Rmd @@ -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()` | diff --git a/README.md b/README.md index c59559840..0c974d469 100644 --- a/README.md +++ b/README.md @@ -67,50 +67,50 @@ output format and all the assets required by this format. Currently included templates and their contributors are the following: -| Journal | Contributors | Pull request | Output format | -|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------| -| [ACM: Association for Computings Machinery](https://www.acm.org/publications/about-publications) | [@ramnathv](https://github.com/ramnathv) | [\#8](https://github.com/rstudio/rticles/pull/8) | `acm_article()` | -| [ACS](https://pubs.acs.org) | [@yufree](https://github.com/yufree) | [\#15](https://github.com/rstudio/rticles/pull/15) | `acs_article()` | -| [AEA: American Economic Association](https://www.aeaweb.org/journals/policies/templates) | [@sboysel](https://github.com/sboysel) | [\#86](https://github.com/rstudio/rticles/pull/86) | `aea_articles()` | -| [AGU](https://agupubs.onlinelibrary.wiley.com/) | [@eliocamp](https://github.com/eliocamp) | [\#199](https://github.com/rstudio/rticles/pull/199) | `agu_article()` | -| [AJS: Austrian Journal of Statistics](https://www.ajs.or.at) | [@matthias-da](https://github.com/matthias-da) | [\#437](https://github.com/rstudio/rticles/pull/437) | `ajs_article()` | -| [AMS: American Meteorological Society](https://www.ametsoc.org/) | [@yufree](https://github.com/yufree) | [\#96](https://github.com/rstudio/rticles/pull/96) | `ams_article()` | -| ASA: American Statistical Association `https://www.amstat.org/` | | [\#111](https://github.com/rstudio/rticles/pull/111) | `asa_article()` | -| [arXiv](https://arxiv.org/) pre-prints based on George Kour’s template | [@alexpghayes](https://github.com) | [\#236](https://github.com/rstudio/rticles/pull/236) | `arxiv_article()` | -| [Bioinformatics](https://academic.oup.com/bioinformatics) | [@ShixiangWang](https://github.com/ShixiangWang) | [\#297](https://github.com/rstudio/rticles/pull/297) | `bioinformatics_article()` | -| [Biometrics](https://biometrics.biometricsociety.org) | [@daltonhance](https://github.com/daltonhance) | [\#170](https://github.com/rstudio/rticles/pull/170) | `biometrics_article()` | -| [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()` | -| [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()` | -| [IMS: Institute of Mathematical Statistics](https://imstat.org/) [AoAS: Annals of Applied Statistics](https://imstat.org/journals-and-publications/annals-of-applied-statistics/) | [@auzaheta](https://github.com/auzaheta) | [\#372](https://github.com/rstudio/rticles/pull/372) | `ims_article()` | -| [INFORMS: Institute for Operations Research and the Management Sciences](https://informs.org/) | [@robjhyndman](https://github.com/robjhyndman) | [\#460](https://github.com/rstudio/rticles/pull/460) | `informs_article()` | -| [ISBA: International Society for Bayesian Analysis](https://bayesian.org/) | [@dmi3nko](https://github.com/dmi3kno) | [\#461](https://github.com/rstudio/rticles/pull/461) | `informs_article()` | -| [IOP: Institute of Physics](https://iopscience.iop.org) | [@robjhyndman](https://github.com/robjhyndman) | [\#462](https://github.com/rstudio/rticles/pull/462) | `iop_article()` | -| [JASA: Journal of the Acoustical Society of America](https://asa.scitation.org/journal/jas) | [@stefanocoretta](https://github.com/stefanocoretta) | [\#364](https://github.com/rstudio/rticles/pull/364) | `jasa_article()` | -| [Journal of Educational Data Mining](https://jedm.educationaldatamining.org/index.php/JEDM/about/submissions) journal submissions | [@jooyoungseo](https://github.com/jooyoungseo) | [\#251](https://github.com/rstudio/rticles/pull/251) | `jedm_article()` | -| [JOSS: Journal of Open Source Software](https://joss.theoj.org/) [JOSE: Journal of Open Source Education](https://jose.theoj.org/) | [@noamross](https://github.com/noamross) | [\#229](https://github.com/rstudio/rticles/pull/229) | `joss_article()` | -| [JSS: Journal of Statistical Software](https://www.jstatsoft.org/index) | | | `jss_article()` | -| [LIPIcs](https://www.dagstuhl.de/en/publications/lipics) | [@nuest](https://github.com/nuest) | [\#288](https://github.com/rstudio/rticles/pull/288) | `lipics_article()` | -| [MDPI](https://www.mdpi.com) | [@dleutnant](https://github.com/dleutnant) | [\#147](https://github.com/rstudio/rticles/pull/147) | `mdpi_article()` | -| [MNRAS: Monthly Notices of the Royal Astronomical Society](https://academic.oup.com/mnras) | [@oleskiewicz](https://github.com/oleskiewicz) | [\#175](https://github.com/rstudio/rticles/pull/175) | `mnras_article()` | -| [OUP: Oxford University Press](https://academic.oup.com/journals/pages/authors/preparing_your_manuscript) | [@dmkaplan](https://github.com/dmkaplan) | [\#284](https://github.com/rstudio/rticles/pull/284) | `oup_articles()` | -| [PeerJ: Journal of Life and Environmental Sciences](https://peerj.com) | [@zkamvar](https://github.com/zkamvar) | [\#127](https://github.com/rstudio/rticles/pull/127) | `peerj_article()` | -| [PiHPh: Papers in Historical Phonology](http://journals.ed.ac.uk/pihph/about/submissions) | [@stefanocoretta](https://github.com/stefanocoretta) | [\#362](https://github.com/rstudio/rticles/pull/362) | `pihph_article()` | -| [PLOS](https://plos.org/#journals) | [@sjmgarnier](https://github.com/sjmgarnier) | [\#12](https://github.com/rstudio/rticles/pull/12) | `plos_article()` | -| [PNAS: Proceedings of the National Academy of Sciences](https://www.pnas.org/) | [@cboettig](https://github.com/cboettig) | [\#72](https://github.com/rstudio/rticles/pull/72) | `pnas_article()` | -| [RSOS: Royal Society Open Science](https://www.royalsocietypublishing.org/journal/rsos) | [@ThierryO](https://github.com/ThierryO) | [\#135](https://github.com/rstudio/rticles/pull/135) | `rsos_article()` | -| [RSS: Royal Statistical Society](https://rss.org.uk/) | [@carlganz](https://github.com/carlganz) | [\#110](https://github.com/rstudio/rticles/pull/110) | `rss_article()` | -| [Sage](https://uk.sagepub.com/en-gb/eur/manuscript-submission-guidelines) | [@oguzhanogreden](https://github.com/oguzhanogreden) | [\#181](https://github.com/rstudio/rticles/pull/181) | `sage_article()` | -| [Springer](https://www.springernature.com/gp/authors/campaigns/latex-author-support) | [@strakaps](https://github.com/strakaps) | [\#164](https://github.com/rstudio/rticles/pull/164) | `springer_article()` | -| [SIM: Statistics in Medicine](https://onlinelibrary.wiley.com/journal/10970258) | [@ellessenne](https://github.com/ellessenne) | [\#231](https://github.com/rstudio/rticles/pull/231) | `sim_article()` | -| [Taylor & Francis](https://www.tandfonline.com/) | [@dleutnant](https://github.com/dleutnant) | [\#218](https://github.com/rstudio/rticles/pull/218) | `tf_article()` | -| [The R Journal](https://journal.r-project.org/) | | | `rjournal_article()` | -| [TRB](https://trb.secure-platform.com/a/page/TRBPaperReview) | [@gregmacfarlane](https://github.com/gregmacfarlane) | [\#427](https://github.com/rstudio/rticles/pull/427) | `trb_article()` | -| [Wellcome Open Research](https://wellcomeopenresearch.org) | [@arnold-c](https://github.com/arnold-c) | [\#436](https://github.com/rstudio/rticles/pull/436) | `wellcomeor_article()` | +| Journal | Contributors | Pull request | Output format | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------| +| [ACM: Association for Computings Machinery](https://www.acm.org/publications/about-publications) | [@ramnathv](https://github.com/ramnathv) | [#8](https://github.com/rstudio/rticles/pull/8) | `acm_article()` | +| [ACS](https://pubs.acs.org) | [@yufree](https://github.com/yufree) | [#15](https://github.com/rstudio/rticles/pull/15) | `acs_article()` | +| [AEA: American Economic Association](https://www.aeaweb.org/journals/policies/templates) | [@sboysel](https://github.com/sboysel) | [#86](https://github.com/rstudio/rticles/pull/86) | `aea_articles()` | +| [AGU](https://agupubs.onlinelibrary.wiley.com/) | [@eliocamp](https://github.com/eliocamp) | [#199](https://github.com/rstudio/rticles/pull/199) | `agu_article()` | +| [AJS: Austrian Journal of Statistics](https://www.ajs.or.at) | [@matthias-da](https://github.com/matthias-da) | [#437](https://github.com/rstudio/rticles/pull/437) | `ajs_article()` | +| [AMS: American Meteorological Society](https://www.ametsoc.org/) | [@yufree](https://github.com/yufree) | [#96](https://github.com/rstudio/rticles/pull/96) | `ams_article()` | +| ASA: American Statistical Association `https://www.amstat.org/` | | [#111](https://github.com/rstudio/rticles/pull/111) | `asa_article()` | +| [arXiv](https://arxiv.org/) pre-prints based on George Kour’s template | [@alexpghayes](https://github.com) | [#236](https://github.com/rstudio/rticles/pull/236) | `arxiv_article()` | +| [Bioinformatics](https://academic.oup.com/bioinformatics) | [@ShixiangWang](https://github.com/ShixiangWang) | [#297](https://github.com/rstudio/rticles/pull/297) | `bioinformatics_article()` | +| [Biometrics](https://biometrics.biometricsociety.org) | [@daltonhance](https://github.com/daltonhance) | [#170](https://github.com/rstudio/rticles/pull/170) | `biometrics_article()` | +| [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), [@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()` | +| [IMS: Institute of Mathematical Statistics](https://imstat.org/) [AoAS: Annals of Applied Statistics](https://imstat.org/journals-and-publications/annals-of-applied-statistics/) | [@auzaheta](https://github.com/auzaheta) | [#372](https://github.com/rstudio/rticles/pull/372) | `ims_article()` | +| [INFORMS: Institute for Operations Research and the Management Sciences](https://informs.org/) | [@robjhyndman](https://github.com/robjhyndman) | [#460](https://github.com/rstudio/rticles/pull/460) | `informs_article()` | +| [ISBA: International Society for Bayesian Analysis](https://bayesian.org/) | [@dmi3nko](https://github.com/dmi3kno) | [#461](https://github.com/rstudio/rticles/pull/461) | `informs_article()` | +| [IOP: Institute of Physics](https://iopscience.iop.org) | [@robjhyndman](https://github.com/robjhyndman) | [#462](https://github.com/rstudio/rticles/pull/462) | `iop_article()` | +| [JASA: Journal of the Acoustical Society of America](https://asa.scitation.org/journal/jas) | [@stefanocoretta](https://github.com/stefanocoretta) | [#364](https://github.com/rstudio/rticles/pull/364) | `jasa_article()` | +| [Journal of Educational Data Mining](https://jedm.educationaldatamining.org/index.php/JEDM/about/submissions) journal submissions | [@jooyoungseo](https://github.com/jooyoungseo) | [#251](https://github.com/rstudio/rticles/pull/251) | `jedm_article()` | +| [JOSS: Journal of Open Source Software](https://joss.theoj.org/) [JOSE: Journal of Open Source Education](https://jose.theoj.org/) | [@noamross](https://github.com/noamross) | [#229](https://github.com/rstudio/rticles/pull/229) | `joss_article()` | +| [JSS: Journal of Statistical Software](https://www.jstatsoft.org/index) | | | `jss_article()` | +| [LIPIcs](https://www.dagstuhl.de/en/publications/lipics) | [@nuest](https://github.com/nuest) | [#288](https://github.com/rstudio/rticles/pull/288) | `lipics_article()` | +| [MDPI](https://www.mdpi.com) | [@dleutnant](https://github.com/dleutnant) | [#147](https://github.com/rstudio/rticles/pull/147) | `mdpi_article()` | +| [MNRAS: Monthly Notices of the Royal Astronomical Society](https://academic.oup.com/mnras) | [@oleskiewicz](https://github.com/oleskiewicz) | [#175](https://github.com/rstudio/rticles/pull/175) | `mnras_article()` | +| [OUP: Oxford University Press](https://academic.oup.com/journals/pages/authors/preparing_your_manuscript) | [@dmkaplan](https://github.com/dmkaplan) | [#284](https://github.com/rstudio/rticles/pull/284) | `oup_articles()` | +| [PeerJ: Journal of Life and Environmental Sciences](https://peerj.com) | [@zkamvar](https://github.com/zkamvar) | [#127](https://github.com/rstudio/rticles/pull/127) | `peerj_article()` | +| [PiHPh: Papers in Historical Phonology](http://journals.ed.ac.uk/pihph/about/submissions) | [@stefanocoretta](https://github.com/stefanocoretta) | [#362](https://github.com/rstudio/rticles/pull/362) | `pihph_article()` | +| [PLOS](https://plos.org/#journals) | [@sjmgarnier](https://github.com/sjmgarnier) | [#12](https://github.com/rstudio/rticles/pull/12) | `plos_article()` | +| [PNAS: Proceedings of the National Academy of Sciences](https://www.pnas.org/) | [@cboettig](https://github.com/cboettig) | [#72](https://github.com/rstudio/rticles/pull/72) | `pnas_article()` | +| [RSOS: Royal Society Open Science](https://www.royalsocietypublishing.org/journal/rsos) | [@ThierryO](https://github.com/ThierryO) | [#135](https://github.com/rstudio/rticles/pull/135) | `rsos_article()` | +| [RSS: Royal Statistical Society](https://rss.org.uk/) | [@carlganz](https://github.com/carlganz) | [#110](https://github.com/rstudio/rticles/pull/110) | `rss_article()` | +| [Sage](https://uk.sagepub.com/en-gb/eur/manuscript-submission-guidelines) | [@oguzhanogreden](https://github.com/oguzhanogreden) | [#181](https://github.com/rstudio/rticles/pull/181) | `sage_article()` | +| [Springer](https://www.springernature.com/gp/authors/campaigns/latex-author-support) | [@strakaps](https://github.com/strakaps) | [#164](https://github.com/rstudio/rticles/pull/164) | `springer_article()` | +| [SIM: Statistics in Medicine](https://onlinelibrary.wiley.com/journal/10970258) | [@ellessenne](https://github.com/ellessenne) | [#231](https://github.com/rstudio/rticles/pull/231) | `sim_article()` | +| [Taylor & Francis](https://www.tandfonline.com/) | [@dleutnant](https://github.com/dleutnant) | [#218](https://github.com/rstudio/rticles/pull/218) | `tf_article()` | +| [The R Journal](https://journal.r-project.org/) | | | `rjournal_article()` | +| [TRB](https://trb.secure-platform.com/a/page/TRBPaperReview) | [@gregmacfarlane](https://github.com/gregmacfarlane) | [#427](https://github.com/rstudio/rticles/pull/427) | `trb_article()` | +| [Wellcome Open Research](https://wellcomeopenresearch.org) | [@arnold-c](https://github.com/arnold-c) | [#436](https://github.com/rstudio/rticles/pull/436) | `wellcomeor_article()` | You can also get the list of available journal names with `rticles::journals()`. diff --git a/inst/rmarkdown/templates/elsevier/resources/template.tex b/inst/rmarkdown/templates/elsevier/resources/template.tex index 5ad849357..27ae2239e 100644 --- a/inst/rmarkdown/templates/elsevier/resources/template.tex +++ b/inst/rmarkdown/templates/elsevier/resources/template.tex @@ -1,12 +1,13 @@ -\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 @@ -53,11 +54,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$ @@ -85,7 +85,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}}} @@ -194,20 +193,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$ + \end{frontmatter} $body$ diff --git a/inst/rmarkdown/templates/elsevier/skeleton/elsarticle.cls b/inst/rmarkdown/templates/elsevier/skeleton/elsarticle.cls index ffee323e4..cf20bdff6 100644 --- a/inst/rmarkdown/templates/elsevier/skeleton/elsarticle.cls +++ b/inst/rmarkdown/templates/elsevier/skeleton/elsarticle.cls @@ -5,36 +5,51 @@ %% The original source files were: %% %% elsarticle.dtx (with options: `class') -%% -%% Copyright 2007, 2008 Elsevier Ltd. -%% +%% +%% Copyright 2007-2020 Elsevier Ltd +%% %% This file is part of the 'Elsarticle Bundle'. %% ------------------------------------------- -%% +%% %% It may be distributed under the conditions of the LaTeX Project Public %% License, either version 1.2 of this license or (at your option) any %% later version. The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.2 or later is part of all distributions of LaTeX %% version 1999/12/01 or later. -%% +%% %% The list of all files belonging to the 'Elsarticle Bundle' is %% given in the file `manifest.txt'. +%% +%% %% -%% $Id: elsarticle.cls,v 1.18 2008-08-28 06:03:47 cvr Exp $ %% \def\RCSfile{elsarticle}% - \def\RCSversion{1.0.1}% - \def\RCSdate{2008/05/22}% + \def\RCSversion{3.3}% + \def\RCSdate{2020/11/20}% \def\@shortjnl{\relax} - \def\@journal{Elsevier Science} \def\@company{Elsevier Science} + \def\@journal{Elsevier Ltd} + \def\@company{Elsevier Ltd} \def\@issn{000-0000} \def\@shortjid{elsarticle} \NeedsTeXFormat{LaTeX2e}[1995/12/01] \ProvidesClass{\@shortjid}[\RCSdate, \RCSversion: \@journal] \def\ABD{\AtBeginDocument} \newif\ifpreprint \preprintfalse +\newif\ifnonatbib \nonatbibfalse \newif\iflongmktitle \longmktitlefalse +\newif\ifnopreprintline \nopreprintlinefalse +\newif\ifdoubleblind \doubleblindfalse + +\newif\ifuseexplthreefunctions \useexplthreefunctionsfalse + +\IfFileExists{expl3.sty}{% + \global\useexplthreefunctionstrue% + \RequirePackage{expl3}}{} +\ifuseexplthreefunctions\relax% +\IfFileExists{xparse.sty}{\RequirePackage{xparse}}{} +\IfFileExists{etoolbox.sty}{\RequirePackage{etoolbox}}{} +\fi \def\@blstr{1} \newdimen\@bls @@ -53,11 +68,13 @@ \DeclareOption{preprint}{\global\preprinttrue \gdef\@blstr{1}\xdef\jtype{0}% \AtBeginDocument{\@twosidefalse\@mparswitchfalse}} +\DeclareOption{nopreprintline}{\global\nopreprintlinetrue} \DeclareOption{final}{\gdef\@blstr{1}\global\preprintfalse} \DeclareOption{review}{\global\preprinttrue\gdef\@blstr{1.5}} -\DeclareOption{authoryear}{\xdef\@biboptions{authoryear}} -\DeclareOption{number}{\xdef\@biboptions{square,numbers}} -\DeclareOption{numbers}{\xdef\@biboptions{square,numbers}} +\DeclareOption{authoryear}{\xdef\@biboptions{round,authoryear}} +\DeclareOption{number}{\xdef\@biboptions{numbers}} +\DeclareOption{numbers}{\xdef\@biboptions{numbers}} +\DeclareOption{nonatbib}{\global\nonatbibtrue} \DeclareOption{longtitle}{\global\longmktitletrue} \DeclareOption{5p}{\xdef\jtype{5}\global\preprintfalse \ExecuteOptions{twocolumn}} @@ -68,58 +85,91 @@ \DeclareOption{times}{\IfFileExists{txfonts.sty}% {\AtEndOfClass{\RequirePackage{txfonts}% \gdef\ttdefault{cmtt}% - \let\iint\relax + \let\iint\relax \let\iiint\relax \let\iiiint\relax \let\idotsint\relax - \let\openbox\relax}}{\RequirePackage{times}}} -\ExecuteOptions{a4paper,10pt,oneside,onecolumn,number,preprint} + \let\openbox\relax}}{\AtEndOfClass{\RequirePackage{times}}}} + +\DeclareOption{endfloat}{\IfFileExists{endfloat.sty} + {\AtEndOfClass{\RequirePackage[markers]{endfloat}}}{}} +\DeclareOption{endfloats}{\IfFileExists{endfloat.sty} + {\AtEndOfClass{\RequirePackage[markers]{endfloat}}}{}} +\DeclareOption{numafflabel} + {\AtBeginDocument{\def\theaffn{\arabic{affn}}}} %*% +\DeclareOption{lefttitle} + {\AtBeginDocument{\def\elsarticletitlealign{flushleft}}} %*% +\DeclareOption{centertitle} + {\AtBeginDocument{\def\elsarticletitlealign{center}}} %*% +\DeclareOption{reversenotenum} + {\AtBeginDocument{\def\theaffn{\arabic{affn}} + \def\thefnote{\alph{fnote}}}} +\DeclareOption{doubleblind}{\doubleblindtrue} + +\ExecuteOptions{a4paper,10pt,oneside,onecolumn,number,preprint,centertitle} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions \LoadClass{article} \RequirePackage{graphicx} \let\comma\@empty \let\tnotesep\@empty -\def\title#1{\gdef\@title{#1}} \let\@title\@empty +\def\useelstitle{} + +\def\title#1{\g@addto@macro\@title{#1% + \global\let\tnoteref\@gobble}% + \g@addto@macro\useelstitle{#1}} + \def\elsLabel#1{\@bsphack\protected@write\@auxout{}% {\string\Newlabel{#1}{\@currentlabel}}\@esphack} \def\Newlabel#1#2{\expandafter\xdef\csname X@#1\endcsname{#2}} -\def\Ref#1{\@ifundefined{X@#1}{0}{\csname X@#1\endcsname}% -} +\def\elsRef#1{\@ifundefined{X@#1}{0}{\csname X@#1\endcsname}} -\def\tnotemark[#1]{\textsuperscript{\@for\@@tmark:=#1\do{% - \edef\tnotenum{\@ifundefined{X@\@@tmark}{1}{\Ref{\@@tmark}}}% - \ifcase\tnotenum\or\ding{73}\or,\ding{73}\ding{73}\fi}}% -} \let\@tnotemark\@empty +\ifdoubleblind + \def\tnotemark[#1]{} +\else + \def\tnotemark[#1]{\@for\mytmark:=#1\do{% + \expandafter\ifcase\elsRef{\mytmark}\or$^{\star}$\or + $^{,\star\star}$\fi + }% +} +\fi + +\def\tnoteref#1{\tnotemark[{#1}]} \let\@tnotes\@empty -\RequirePackage{pifont} \newcounter{tnote} \def\tnotetext[#1]#2{\g@addto@macro\@tnotes{% - \refstepcounter{tnote}\elsLabel{#1}% - \def\thefootnote{\ifcase\c@tnote\or\ding{73}\or\ding{73}\ding{73}\fi}% + \stepcounter{tnote}\elsLabel{#1}% + \def\thefootnote{\ifcase\c@tnote\or$\star$\or$\star\star$\fi}% \footnotetext{#2}}} +\let\@nonumnotes\@empty +\def\nonumnote#1{\g@addto@macro\@nonumnotes{% + \let\thefootnote\relax\footnotetext{#1}}} + \newcounter{fnote} +\def\thefnote{\arabic{fnote}} \def\fnmark[#1]{\let\comma\@empty \def\@fnmark{\@for\@@fnmark:=#1\do{% - \edef\fnotenum{\@ifundefined{X@\@@fnmark}{1}{\Ref{\@@fnmark}}}% + \edef\fnotenum{\@ifundefined{X@\@@fnmark}{1}{\elsRef{\@@fnmark}}}% \unskip\comma\fnotenum\let\comma,}}% } +\def\fnref#1{\fnmark[#1]} + \let\@fnotes\@empty\let\@fnmark\@empty \def\fntext[#1]#2{\g@addto@macro\@fnotes{% - \refstepcounter{fnote}\elsLabel{#1}% - \def\thefootnote{\thefnote}% - \global\setcounter{footnote}{\thefnote}% + \refstepcounter{fnote}\elsLabel{#1}% + \def\thefootnote{\c@fnote}% + \global\setcounter{footnote}{\c@fnote}% \footnotetext{#2}}} -\def\cormark[#1]{\edef\cnotenum{\Ref{#1}}\unskip% - \textsuperscript{\sep\ifcase\cnotenum\or +\def\cormark[#1]{\edef\cnotenum{\elsRef{#1}}% + \unskip\textsuperscript{\sep\ifcase\cnotenum\or $\ast$\or$\ast\ast$\fi\hspace{-1pt}}\let\sep=,} \let\@cormark\@empty @@ -131,83 +181,465 @@ $\ast\ast$\fi}% \footnotetext{#2}}} -\def\corref#1{\cormark[#1]} -\def\fnref#1{\fnmark[#1]} -\def\tnoteref#1{\tnotemark[#1]} +\let\@corref\@empty +\def\corref#1{\edef\cnotenum{\elsRef{#1}}% + \edef\@corref{\ifcase\cnotenum\or + $\ast$\or$\ast\ast$\fi\hskip-1pt}} \def\resetTitleCounters{\c@cnote=0 \c@fnote=0 \c@tnote=0 \c@footnote=0} \let\eadsep\@empty -\let\@elseads\@empty +\def\@elseads{} \let\@elsuads\@empty \let\@cormark\@empty -\def\ead{\@ifnextchar[{\@uad}{\@ead}} -\gdef\@ead#1{\bgroup\def\_{\string\_}\def\{{\string\{}% - \def\}{\string\}}% - \edef\tmp{\the\@eadauthor} +\def\hashchar{\expandafter\@gobble\string\~} +\def\underscorechar{\expandafter\@gobble\string\_} +\def\lbracechar{\expandafter\@gobble\string\{} +\def\rbracechar{\expandafter\@gobble\string\}} + +\gdef\ead{\@ifnextchar[{\@uad}{\@ead}} +\gdef\@ead#1{\bgroup + \def\_{\underscorechar}% + \def\{{\lbracechar}% + \def~{\hashchar}% + \def\}{\rbracechar}% + \edef\tmp{\the\@eadauthor}% \immediate\write\@auxout{\string\emailauthor {#1}{\expandafter\strip@prefix\meaning\tmp}}% - \egroup + \egroup } \newcounter{ead} \gdef\emailauthor#1#2{\stepcounter{ead}% \g@addto@macro\@elseads{\raggedright% - \let\corref\@gobble - \eadsep\texttt{#1} (#2)\def\eadsep{\unskip,\space}}% + \let\corref\@gobble\def\@@tmp{#1}% + \eadsep{\ttfamily\expandafter\strip@prefix\meaning\@@tmp} + (#2)\def\eadsep{\unskip,\space}}% } \gdef\@uad[#1]#2{\bgroup + \def~{\hashchar}% + \def\_{\underscorechar}% + \def~{\hashchar}% + \def\}{\rbracechar}% \edef\tmp{\the\@eadauthor} \immediate\write\@auxout{\string\urlauthor {#2}{\expandafter\strip@prefix\meaning\tmp}}% \egroup } -\def\urlauthor#1#2{\g@addto@macro\@elsuads{\let\corref\@gobble% - \raggedright\eadsep\texttt{#1}\space(#2)% +\gdef\urlauthor#1#2{\g@addto@macro\@elsuads{\let\corref\@gobble% + \def\@@tmp{#1}\raggedright\eadsep + {\ttfamily\expandafter\strip@prefix\meaning\@@tmp}\space(#2)% \def\eadsep{\unskip,\space}}% } \def\elsauthors{} +\def\useauthors{} +\def\elsprelimauthors{} + \def\pprinttitle{} \let\authorsep\@empty +\let\prelimauthorsep\@empty \let\sep\@empty \newcounter{author} \def\author{\@ifnextchar[{\@@author}{\@author}} \newtoks\@eadauthor -\def\@@author[#1]#2{\g@addto@macro\elsauthors{% +\def\@@author[#1]#2{% + \g@addto@macro\elsprelimauthors{% + \prelimauthorsep#2% + \def\prelimauthorsep{\unskip,\space}}% + \g@addto@macro\elsauthors{% \def\baselinestretch{1}% \authorsep#2\unskip\textsuperscript{%#1% \@for\@@affmark:=#1\do{% - \edef\affnum{\@ifundefined{X@\@@affmark}{1}{\Ref{\@@affmark}}}% + \edef\affnum{\@ifundefined{X@\@@affmark}{1}{\elsRef{\@@affmark}}}% \unskip\sep\affnum\let\sep=,}% - \ifx\@fnmark\@empty\else\unskip\sep\@fnmark\let\sep=,\fi}% + \ifx\@fnmark\@empty\else\unskip\sep\@fnmark\let\sep=,\fi + \ifx\@corref\@empty\else\unskip\sep\@corref\let\sep=,\fi + }% \def\authorsep{\unskip,\space}% - \global\let\sep\@empty + \global\let\sep\@empty\global\let\@corref\@empty \global\let\@fnmark\@empty}% - \@eadauthor={#2} + \@eadauthor={#2}% + \g@addto@macro\useauthors{#2; }% } -\def\@author#1{\g@addto@macro\elsauthors{\normalsize% +\def\@author#1{% + \g@addto@macro\elsprelimauthors{% + \prelimauthorsep#1% + \def\prelimauthorsep{\unskip,\space}}% + \g@addto@macro\elsauthors{\normalsize% \def\baselinestretch{1}% \upshape\authorsep#1\unskip\textsuperscript{% - \ifx\@fnmark\@empty\else\unskip\sep\@fnmark\let\sep=,\fi}% + \ifx\@fnmark\@empty\else\unskip\sep\@fnmark\let\sep=,\fi + \ifx\@corref\@empty\else\unskip\sep\@corref\let\sep=,\fi + }% \def\authorsep{\unskip,\space}% \global\let\@fnmark\@empty - \global\let\sep\@empty}% - \@eadauthor={{#1}} + \global\let\@corref\@empty \global\let\sep\@empty}% + \@eadauthor={#1}% + \g@addto@macro\useauthors{#1; }% +} + +\AtBeginDocument{% + \@ifpackageloaded{hyperref}{% + \expandafter\gdef\csname Hy@title\endcsname{\useelstitle}% + \expandafter\gdef\csname Hy@author\endcsname{\useauthors}% + }{} } \def\elsaddress{} \def\addsep{\par\vskip6pt} -\def\address{\@ifnextchar[{\@@address}{\@address}} + +\def\@alph#1{% + \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or + l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or + y\or z% + \or aa\or ab\or ac\or ad\or ae\or af\or ag\or ah\or ai\or aj\or + ak\or al\or am\or an\or ao\or ap\or aq\or ar\or as\or at\or au\or + av\or aw\or ax\or ay\or az% + \or ba\or bb\or bc\or bd\or be\or bf\or bg\or bh\or bi\or bj\or + bk\or bl\or bm\or bn\or bo\or bp\or bq\or br\or bs\or bt\or bu\or + bv\or bw\or bx\or by\or bz% + \or ca\or cb\or cc\or cd\or ce\or cf\or cg\or ch\or ci\or cj\or + ck\or cl\or cm\or cn\or co\or cp\or cq\or cr\or cs\or ct\or cu\or + cv\or cw\or cx\or cy\or cz% + \or da\or db\or dc\or dd\or de\or df\or dg\or dh\or di\or dj\or + dk\or dl\or dm\or dn\or do\or dp\or dq\or dr\or ds\or dt\or du\or + dv\or dw\or dx\or dy\or dz% + \or ea\or eb\or ec\or ed\or ee\or ef\or eg\or eh\or ei\or ej\or + ek\or el\or em\or en\or eo\or ep\or eq\or er\or es\or et\or eu\or + ev\or ew\or ex\or ey\or ez% + \or fa\or fb\or fc\or fd\or fe\or ff\or fg\or fh\or fi\or fj\or + fk\or fl\or fm\or fn\or fo\or fp\or fq\or fr\or fs\or ft\or fu\or + fv\or fw\or fx\or fy\or fz% + \or ga\or gb\or gc\or gd\or ge\or gf\or gg\or gh\or gi\or gj\or + gk\or gl\or gm\or gn\or go\or gp\or gq\or gr\or gs\or gt\or gu\or + gv\or gw\or gx\or gy\or gz% + \else\@ctrerr\fi} \newcounter{affn} \renewcommand\theaffn{\alph{affn}} +\ifuseexplthreefunctions\relax% + \ExplSyntaxOn + \def\ca_affitem_postskip{\mbox{~}\unskip\ignorespaces} + %%Author Address + \DeclareDocumentCommand \ca_organization { O{,} m } + { + % #2 #1\mbox{~}\unskip\ignorespaces + \csgappto { ca_affiliation_values } { #2 #1\ca_affitem_postskip } + } + \DeclareDocumentCommand \ca_postal_code { O{,} m } + { + % #2 #1\mbox{~}\unskip\ignorespaces + \csgappto { ca_affiliation_values } { #2 #1\ca_affitem_postskip } + } + \DeclareDocumentCommand \ca_aff_city { O{,} m } + { + % #2 #1\mbox{~}\unskip\ignorespaces + \csgappto { ca_affiliation_values } { #2 #1\ca_affitem_postskip } + } + \DeclareDocumentCommand \ca_address_line { O{,}m } + { + % #2 #1\mbox{~}\unskip\ignorespaces + \csgappto { ca_affiliation_values } { #2 #1\ca_affitem_postskip } + } + \DeclareDocumentCommand \ca_state { O{,} m } + { + % #2 #1\mbox{~}\unskip\ignorespaces + \csgappto { ca_affiliation_values } { #2 #1\ca_affitem_postskip } + } + \DeclareDocumentCommand \ca_country { O{ } m } + { + % #2 #1 + \csgappto { ca_affiliation_values } { #2 #1 } + } + + \DeclareDocumentCommand \ca_stm_organization { O{,} m } + { + #2 #1\ca_affitem_postskip + } + \DeclareDocumentCommand \ca_stm_postal_code { O{,} m } + { + #2 #1\ca_affitem_postskip + } + \DeclareDocumentCommand \ca_stm_aff_city { O{,} m } + { + #2 #1\ca_affitem_postskip + } + \DeclareDocumentCommand \ca_stm_aff_address_line { O{,}m } + { + #2 #1\ca_affitem_postskip + } + \DeclareDocumentCommand \ca_stm_state { O{,} m } + { + #2 #1\ca_affitem_postskip + } + \DeclareDocumentCommand \ca_stm_country { O{ } m } + { + #2 #1 + } + + \keys_define:nn { stm / affiliation } + { + op .tl_set_x:N = \l_organization_punc_tl, + oraganizationsep .tl_set_x:N = \l_organization_punc_tl, + ap .tl_set_x:N = \l_address_line_punc_tl, + addresslinesep .tl_set_x:N = \l_address_line_punc_tl, + cp .tl_set_x:N = \l_city_punc_tl, + citysep .tl_set_x:N = \l_city_punc_tl, + pp .tl_set_x:N = \l_postal_code_punc_tl, + postcodesep .tl_set_x:N = \l_postal_code_punc_tl, + sp .tl_set_x:N = \l_state_punc_tl, + statesep .tl_set_x:N = \l_state_punc_tl, + o .code:n = { \ca_organization[\l_organization_punc_tl]{#1} }, + organization .code:n = { \ca_organization[\l_organization_punc_tl]{#1} }, + a .code:n = { \ca_address_line[\l_address_line_punc_tl]{#1} }, + addressline .code:n = { \ca_address_line[\l_address_line_punc_tl]{#1} }, + c .code:n = { \ca_aff_city[\l_city_punc_tl]{#1} }, + city .code:n = { \ca_aff_city[\l_city_punc_tl]{#1} }, + p .code:n = { \ca_postal_code[\l_postal_code_punc_tl]{#1} }, + postcode .code:n = { \ca_postal_code[\l_postal_code_punc_tl]{#1} }, + s .code:n = { \ca_state[\l_state_punc_tl]{#1} }, + state .code:n = { \ca_state[\l_state_punc_tl]{#1} }, + orp .tl_set_x:N = \l_organization_punc_tl, + adp .tl_set_x:N = \l_address_line_punc_tl, + cip .tl_set_x:N = \l_city_punc_tl, + pcp .tl_set_x:N = \l_postal_code_punc_tl, + stp .tl_set_x:N = \l_state_punc_tl, + cyp .tl_set_x:N = \l_country_punc_tl, + or .code:n = { \ca_organization[\l_organization_punc_tl]{#1} }, + ad .code:n = { \ca_address_line[\l_address_line_punc_tl]{#1} }, + ci .code:n = { \ca_aff_city[\l_city_punc_tl]{#1} }, + pc .code:n = { \ca_postal_code[\l_postal_code_punc_tl]{#1} }, + st .code:n = { \ca_state[\l_state_punc_tl]{#1} }, + cy .code:n = { \ca_country[\l_country_punc_tl]{#1} }, + country .code:n = { \ca_country[\l_country_punc_tl]{#1} }, + unknown .code:n = { + \ifstrempty { #1 } { + \csxappto { ca_affiliation_values } + { {\l_keys_key_tl}~ } + } { + \csxappto { ca_affiliation_values } + { {#1}~ } + } + } + } + + \cs_set:Npn \__reset_affiliation: + { + \tl_gset:Nn \l_organization_punc_tl { , } + \tl_gset:Nn \l_address_line_punc_tl { , } + \tl_gset:Nn \l_city_punc_tl { , } + \tl_gset:Nn \l_postal_code_punc_tl { , } + \tl_gset:Nn \l_state_punc_tl { , } + \tl_gset:Nn \l_country_punc_tl { } + } + + \DeclareDocumentCommand\affiliation{ o m }{ + \__reset_affiliation: + \csgdef { ca_affiliation_values } { } + \IfNoValueTF { #2 } + { } + { + \keys_set:nn { stm / affiliation } { #2 } + } + \csgappto{elsaddress}{ + \def\baselinestretch{1}% + \refstepcounter{affn} + \xdef\@currentlabel{\theaffn} + \IfNoValueTF { #1 } + { } + { \elsLabel{#1} } + \textsuperscript{\theaffn}} + \csxappto{elsaddress}{ + \csuse { ca_affiliation_values } + \par + } + } + \ExplSyntaxOff + \else% + \def\caaffitempostskip{\space} + + \DeclareRobustCommand\caorganization[2][,]{% + \g@addto@macro\caaffiliationvalues{#2#1\caaffitempostskip}% + } + \DeclareRobustCommand\capostalcode[2][,]{% + \g@addto@macro\caaffiliationvalues{#2#1\caaffitempostskip}% + } + \DeclareRobustCommand\caaffcity[2][,]{% + \g@addto@macro\caaffiliationvalues{#2#1\caaffitempostskip}% + } + \DeclareRobustCommand\caaddressline[2][,]{% + \g@addto@macro\caaffiliationvalues{#2#1\caaffitempostskip}% + } + \DeclareRobustCommand\castate[2][,]{% + \g@addto@macro\caaffiliationvalues{#2#1\caaffitempostskip}% + } + \DeclareRobustCommand\cacountry[2][,]{% + \g@addto@macro\caaffiliationvalues{#2#1\caaffitempostskip}% + } + \DeclareRobustCommand\castmorganization[2][,]{% + #2#1\caaffitempostskip% + } + \DeclareRobustCommand\castmpostalcode[2][,]{% + #2#1\caaffitempostskip% + } + \DeclareRobustCommand\castmaffcity[2][,]{% + #2#1\caaffitempostskip% + } + \DeclareRobustCommand\castmaddressline[2][,]{% + #2#1\caaffitempostskip% + } + \DeclareRobustCommand\castmstate[2][,]{% + #2#1\caaffitempostskip% + } + \DeclareRobustCommand\castmcountry[2][,]{% + #2#1\caaffitempostskip% + } + + \define@key{affiliation}{op}{\xdef\@organizationpunc{#1}} + \define@key{affiliation}{orp}{\xdef\@organizationpunc{#1}} + \define@key{affiliation}{organizationsep}{\xdef\@organizationpunc{#1}} + \define@key{affiliation}{ap}{\xdef\@addresslinepunc{#1}} + \define@key{affiliation}{adp}{\xdef\@addresslinepunc{#1}} + \define@key{affiliation}{addresslinesep}{\xdef\@addresslinepunc{#1}} + \define@key{affiliation}{cp}{\xdef\@citypunc{#1}} + \define@key{affiliation}{cip}{\xdef\@citypunc{#1}} + \define@key{affiliation}{cyp}{\xdef\@countrypunc{#1}} + \define@key{affiliation}{citysep}{\xdef\@citypunc{#1}} + \define@key{affiliation}{pp}{\xdef\@postcodepunc{#1}} + \define@key{affiliation}{pop}{\xdef\@postcodepunc{#1}} + \define@key{affiliation}{postcodesep}{\xdef\@postcodepunc{#1}} + \define@key{affiliation}{sp}{\xdef\@statepunc{#1}} + \define@key{affiliation}{stp}{\xdef\@statepunc{#1}} + \define@key{affiliation}{statesep}{\xdef\@statepunc{#1}} + \define@key{affiliation}{countrysep}{\xdef\@countrypunc{#1}} + + \define@key{affiliation}{organization}{% + \caorganization[\@organizationpunc]{#1}} + \define@key{affiliation}{addressline}{% + \caaddressline[\@addresslinepunc]{#1}} + \define@key{affiliation}{city}{% + \caaffcity[\@citypunc]{#1}} + \define@key{affiliation}{postcode}{% + \capostalcode[\@postcodepunc]{#1}} + \define@key{affiliation}{state}{% + \castate[\@statepunc]{#1}} + \define@key{affiliation}{or}{% + \caorganization[\@organizationpunc]{#1}} + \define@key{affiliation}{ad}{% + \caaddressline[\@addresslinepunc]{#1}} + \define@key{affiliation}{ci}{% + \caaffcity[\@citypunc]{#1}} + \define@key{affiliation}{po}{% + \capostalcode[\@postcodepunc]{#1}} + \define@key{affiliation}{st}{% + \castate[\@statepunc]{#1}} + \define@key{affiliation}{o}{% + \caorganization[\@organizationpunc]{#1}} + \define@key{affiliation}{a}{% + \caaddressline[\@addresslinepunc]{#1}} + \define@key{affiliation}{c}{% + \cacity[\@citypunc]{#1}} + \define@key{affiliation}{p}{% + \capostcode[\@postcodepunc]{#1}} + \define@key{affiliation}{s}{% + \castate[\@statepunc]{#1}} + \define@key{affiliation}{cy}{% + \cacountry[\@countrypunc]{#1}} + \define@key{affiliation}{country}{% + \cacountry[\@countrypunc]{#1}} + + \gdef\@resetaffiliation{% + \gdef\@organizationpunc{,}% + \gdef\@addresslinepunc{,}% + \gdef\@citypunc{,}% + \gdef\@statepunc{,}% + \gdef\@postcodepunc{,}% + \gdef\@countrypunc{}% + } + + \def\affiliation{\@ifnextchar[{\@@affiliation}{\@affiliation}} + + \newcommand*{\newstmrobustcmd}{} + \protected\def\newstmrobustcmd{\@star@or@long\stmetb@new@command} + + \def\stmetb@new@command#1{\@testopt{\stmetb@newcommand#1}0} + + \def\stmetb@newcommand#1[#2]{% + \@ifnextchar[%] + {\stmetb@xargdef#1[#2]} + {\ifx\l@ngrel@x\relax + \let\l@ngrel@x\protected + \else + \protected\def\l@ngrel@x{\protected\long}% + \fi + \@argdef#1[#2]}} + + \long\def\stmetb@xargdef#1[#2][#3]#4{% + \@ifdefinable#1{% + \expandafter\protected + \expandafter\def + \expandafter#1% + \expandafter{% + \expandafter\@testopt + \csname\string#1\endcsname{#3}}% + \expandafter\@yargdef\csname\string#1\endcsname\tw@{#2}{#4}}} + % + \newcommand{\ifstmundef}[1]{% + \ifdefined#1% + \ifx#1\relax + \expandafter\expandafter + \expandafter\@firstoftwo + \else + \expandafter\expandafter + \expandafter\@secondoftwo + \fi + \else + \expandafter\@firstoftwo + \fi} + \newcommand{\stmexpandonce}[1]{% + \unexpanded\expandafter{#1}} + \newstmrobustcmd{\gstmappto}[2]{% + \ifundef{#1} + {\xdef#1{\unexpanded{#2}}} + {\xdef#1{\stmexpandonce#1\unexpanded{#2}}}} + \newstmrobustcmd{\xstmappto}[2]{% + \ifstmundef{#1} + {\xdef#1{#2}} + {\xdef#1{\stmexpandonce#1#2}}} + + \long\def\@@affiliation[#1]#2{% + \@resetaffiliation% + \gdef\caaffiliationvalues{}% + \elsLabel{#1}% + \setkeys{affiliation}{#2}% + \g@addto@macro\elsaddress{% + \def\baselinestretch{1}% + \refstepcounter{affn}% + \xdef\@currentlabel{\theaffn}% + \elsLabel{#1}% + \textsuperscript{\theaffn}} + \xstmappto\elsaddress{\caaffiliationvalues\par}} + + \long\def\@affiliation#1{% + \@resetaffiliation% + \gdef\caaffiliationvalues{}% + \setkeys{affiliation}{#1}% + \g@addto@macro\elsauthors{% + \def\baselinestretch{1}}% + \xstmappto\elsaddress{\caaffiliationvalues\par}} +\fi + +\def\address{\@ifnextchar[{\@@address}{\@address}} + \long\def\@@address[#1]#2{\g@addto@macro\elsaddress{% \def\baselinestretch{1}% - \refstepcounter{affn}\elsLabel{#1}% + \refstepcounter{affn} + \xdef\@currentlabel{\theaffn} + \elsLabel{#1}% \textsuperscript{\theaffn}#2\par}} \long\def\@address#1{\g@addto@macro\elsauthors{% @@ -216,13 +648,66 @@ \def\authorsep{\par\vskip8pt}}} \newbox\absbox +\let\@elsarticleabstitle\@empty %*% +\def\abstracttitle#1{\gdef\@elsarticleabstitle{#1}} %*% +\abstracttitle{Abstract} %*% \renewenvironment{abstract}{\global\setbox\absbox=\vbox\bgroup \hsize=\textwidth\def\baselinestretch{1}% - \noindent\unskip\textbf{Abstract} + \noindent\unskip\textbf{\@elsarticleabstitle} %*% + \par\medskip\noindent\unskip\ignorespaces} + {\egroup} + +\newbox\elsarticlehighlightsbox +\newbox\elsarticlegrabsbox +\def\@elsarticlehighlightstitle{Highlights} +\def\@elsarticlegrabstitle{Graphical Abstract} +\newif\ifelsprelimpagegrabs\global\elsprelimpagegrabsfalse +\newif\ifelsprelimpagehl\global\elsprelimpagehlfalse +\def\elsarticleprelims{% + \ifelsprelimpagegrabs\relax% + \thispagestyle{empty}% + \unvbox\elsarticlegrabsbox% + \pagebreak\clearpage% + \fi% + \ifelsprelimpagehl\relax% + \thispagestyle{empty} + \unvbox\elsarticlehighlightsbox% + \pagebreak\clearpage% + \setcounter{page}{1}% + \fi% +} +\newenvironment{highlights}{% + \global\elsprelimpagehltrue% + \global\setbox\elsarticlehighlightsbox=\vbox\bgroup + \hsize=\textwidth\def\baselinestretch{1}% + \noindent\unskip{\Large\@elsarticlehighlightstitle}%*% + \par\vskip12pt\noindent\unskip\ignorespaces\textbf{\@title}% + \ifx\elsprelimauthors\@empty\relax\else% + \par\vskip6pt\noindent\unskip\ignorespaces\elsprelimauthors% + \fi% + \par\medskip\noindent\unskip\ignorespaces + \begin{itemize} + } + {\end{itemize} + \egroup} +\newenvironment{graphicalabstract}{% + \global\elsprelimpagegrabstrue% + \global\setbox\elsarticlegrabsbox=\vbox\bgroup + \hsize=\textwidth\def\baselinestretch{1}% + \noindent\unskip{\Large\@elsarticlegrabstitle}%*% + \par\vskip12pt\noindent\unskip\ignorespaces\textbf{\@title}% + \ifx\elsprelimauthors\@empty\relax\else% + \par\vskip6pt\noindent\unskip\ignorespaces\elsprelimauthors% + \fi% \par\medskip\noindent\unskip\ignorespaces} {\egroup} \newbox\keybox +\let\@elsarticlekwdtitle\@empty %*% +\def\keywordtitle#1{\gdef\@elsarticlekwdtitle{#1}} %*% +\def\keywordtitlesep#1{\gdef\@elsarticlekeywordtitlesep{#1}} %*% +\keywordtitle{Keywords} %*% +\keywordtitlesep{:\ } \def\keyword{% \def\sep{\unskip, }% \def\MSC{\@ifnextchar[{\@MSC}{\@MSC[2000]}} @@ -232,7 +717,7 @@ \global\setbox\keybox=\vbox\bgroup\hsize=\textwidth \normalsize\normalfont\def\baselinestretch{1} \parskip\z@ - \noindent\textit{Key words: } + \noindent\textit{\@elsarticlekwdtitle\@elsarticlekeywordtitlesep} \raggedright % Keywords are not justified. \ignorespaces} \def\endkeyword{\par \egroup} @@ -242,8 +727,12 @@ \def\printFirstPageNotes{% \iflongmktitle - \let\columnwidth=\textwidth\fi + \let\columnwidth=\textwidth + \fi +\ifdoubleblind +\else \ifx\@tnotes\@empty\else\@tnotes\fi + \ifx\@nonumnotes\@empty\else\@nonumnotes\fi \ifx\@cornotes\@empty\else\@cornotes\fi \ifx\@elseads\@empty\relax\else \let\thefootnote\relax @@ -255,28 +744,49 @@ \let\thefootnote\relax \footnotetext{\textit{URL:\space}% \@elsuads}\fi +\fi \ifx\@fnotes\@empty\else\@fnotes\fi \iflongmktitle\if@twocolumn \let\columnwidth=\Columnwidth\fi\fi } +%% Pushing text to begin on newpage %*% +\def\newpage@after@title{title} +\def\newpage@after@author{author} +\def\newpage@after@abstract{abstract} +\def\newpageafter#1% + {\gdef\@elsarticlenewpageafter{#1}} + \long\def\pprintMaketitle{\clearpage \iflongmktitle\if@twocolumn\let\columnwidth=\textwidth\fi\fi \resetTitleCounters \def\baselinestretch{1}% \printFirstPageNotes - \begin{center}% + \begin{\elsarticletitlealign}% \thispagestyle{pprintTitle}% \def\baselinestretch{1}% - \Large\@title\par\vskip18pt - \normalsize\elsauthors\par\vskip10pt - \footnotesize\itshape\elsaddress\par\vskip36pt - %\hrule\vskip12pt + \Large\@title\par\vskip18pt% + \ifx\@elsarticlenewpageafter\newpage@after@title% %*% + \newpage + \fi% + \ifdoubleblind + \vspace*{2pc} + \else + \normalsize\elsauthors\par\vskip10pt + \footnotesize\itshape\elsaddress\par\vskip36pt + \fi + \ifx\@elsarticlenewpageafter\newpage@after@author% %*% + \newpage + \fi% + \hrule\vskip12pt \ifvoid\absbox\else\unvbox\absbox\par\vskip10pt\fi \ifvoid\keybox\else\unvbox\keybox\par\vskip10pt\fi - %\hrule\vskip12pt - \end{center}% - \gdef\thefootnote{\arabic{footnote}}% + \hrule\vskip12pt + \ifx\@elsarticlenewpageafter\newpage@after@abstract% %*% + \newpage + \fi% + \end{\elsarticletitlealign}% + \gdef\thefootnote{\arabic{footnote}}% } \def\printWarning{% @@ -299,17 +809,21 @@ \long\def\MaketitleBox{% \resetTitleCounters \def\baselinestretch{1}% - \begin{center}% + \begin{\elsarticletitlealign}% \def\baselinestretch{1}% \Large\@title\par\vskip18pt + \ifdoubleblind + \vspace*{2pc} + \else \normalsize\elsauthors\par\vskip10pt \footnotesize\itshape\elsaddress\par\vskip36pt - %\hrule\vskip12pt + \fi + \hrule\vskip12pt \ifvoid\absbox\else\unvbox\absbox\par\vskip10pt\fi \ifvoid\keybox\else\unvbox\keybox\par\vskip10pt\fi - %\hrule\vskip12pt - \end{center}% - } + \hrule\vskip12pt + \end{\elsarticletitlealign}% +} \def\FNtext#1{\par\bgroup\footnotesize#1\egroup} \newdimen\space@left @@ -317,6 +831,39 @@ \typeout{#1}% \typeout{******************************}% } + +\def\titlespancalculator#1#2#3#4{% + % break count + \@tempcnta=#4\relax% + % pagebreakcount increment + \advance\@tempcnta by 1\relax% + % title page height + \@tempdima=#1\relax% + % Page height - title page notes height (only for first break) + % Page height - textheight (for remaining breaks) + % Page height - title page notes height + \@tempdimb=#2\relax% + % Remaining title page height + \advance\@tempdima -\the\@tempdimb% + % Checks if remaining title page + % height less than textheight + \ifdim\the\@tempdima>#3\relax% + \titlespancalculator% + {\the\@tempdima}{#3}{#3}{\the\@tempcnta}%Break again + \else% + % Save break count and exit. + \xdef\savetitlepagespan{\the\@tempcnta}% + \fi% +}% + +\long\def\myfor#1#2#3{% + \@tempcnta=#1\relax% + \ifnum#1<#2\relax% + \advance\@tempcnta by 1\relax% + #3% + \myfor{\the\@tempcnta}{#2}{#3}% + \fi} + \long\def\getSpaceLeft{%\global\@twocolumnfalse% \global\setbox0=\vbox{\hsize=\textwidth\MaketitleBox}% \global\setbox1=\vbox{\hsize=\textwidth @@ -327,6 +874,9 @@ \@tempdima=\vsize \advance\@tempdima-\noteheight \advance\@tempdima-1\baselineskip + \xdef\savefpageheight{\the\@tempdima}% + \setbox2=\vbox{\titlespancalculator{\titleheight}% + {\savefpageheight}{\textheight}{0}}% } \skip\footins=24pt @@ -335,15 +885,25 @@ \newbox\els@boxb \ifpreprint - \def\maketitle{\pprintMaketitle} + \def\maketitle{\elsarticleprelims\pprintMaketitle} \else \ifnum\jtype=1 \def\maketitle{% + \elsarticleprelims% \iflongmktitle\getSpaceLeft + \ifdim\noteheight>0pt% + \advance\@tempdima-1.35\baselineskip + \fi% \global\setbox\els@boxa=\vsplit0 to \@tempdima \box\els@boxa\par\resetTitleCounters \thispagestyle{pprintTitle}% \printFirstPageNotes + \ifnum\savetitlepagespan>1\relax% + \myfor{2}{\savetitlepagespan}{% + \global\setbox\els@boxb=\vsplit0 to \textheight%\@tempdima + \box\els@boxb} + \else% + \fi% \box0% \else \finalMaketitle\printFirstPageNotes @@ -352,11 +912,21 @@ \else \ifnum\jtype=5 \def\maketitle{% + \elsarticleprelims% \iflongmktitle\getSpaceLeft + \ifdim\noteheight>0pt% + \advance\@tempdima-1.35\baselineskip + \fi% \global\setbox\els@boxa=\vsplit0 to \@tempdima \box\els@boxa\par\resetTitleCounters \thispagestyle{pprintTitle}% \printFirstPageNotes + \ifnum\savetitlepagespan>1\relax% + \myfor{2}{\savetitlepagespan}{% + \global\setbox\els@boxb=\vsplit0 to \textheight%\@tempdima + \twocolumn[\box\els@boxb]} + \else% + \fi% \twocolumn[\box0]%\printFirstPageNotes \else \twocolumn[\finalMaketitle]\printFirstPageNotes @@ -365,11 +935,21 @@ \else \if@twocolumn \def\maketitle{% - \iflongmktitle\getSpaceLeft + \elsarticleprelims% + \iflongmktitle\getSpaceLeft + \ifdim\noteheight>0pt% + \advance\@tempdima-1.35\baselineskip + \fi% \global\setbox\els@boxa=\vsplit0 to \@tempdima \box\els@boxa\par\resetTitleCounters \thispagestyle{pprintTitle}% \printFirstPageNotes + \ifnum\savetitlepagespan>1\relax% + \myfor{2}{\savetitlepagespan}{% + \global\setbox\els@boxb=\vsplit0 to \textheight%\@tempdima + \twocolumn[\box\els@boxb]} + \else% + \fi% \twocolumn[\box0]% \else \twocolumn[\finalMaketitle]\printFirstPageNotes @@ -377,13 +957,24 @@ \gdef\thefootnote{\arabic{footnote}}}% \else \def\maketitle{% + \elsarticleprelims% \iflongmktitle\getSpaceLeft + \ifdim\noteheight>0pt% + \advance\@tempdima-1.35\baselineskip + \fi% \global\setbox\els@boxa=\vsplit0 to \@tempdima \box\els@boxa\par\resetTitleCounters \thispagestyle{pprintTitle}% \printFirstPageNotes + \ifnum\savetitlepagespan>1\relax% + \myfor{2}{\savetitlepagespan}{% + \global\setbox\els@boxb=\vsplit0 to \textheight%\@tempdima + \box\els@boxb} + \else% + \fi% \box0% \else + \elsarticleprelims% \finalMaketitle\printFirstPageNotes \fi \gdef\thefootnote{\arabic{footnote}}}% @@ -391,14 +982,44 @@ \fi \fi \fi + +\let\@elsarticlemyfooter\@empty +\let\@elsarticlemyfooteralign\@empty +\def\@elsarticlemyfooteralignleft{L} +\def\@elsarticlemyfooteralignright{R} +\def\@elsarticlemyfooteraligncenter{C} + +\def\myfooter[#1]#2 %*% + {\gdef\@elsarticlemyfooteralign{#1} + \gdef\@elsarticlemyfooter{#2}} + +\def\myfooterfont#1{\gdef\@myfooterfont{#1}} +\myfooterfont{\footnotesize\itshape} \def\ps@pprintTitle{% \let\@oddhead\@empty \let\@evenhead\@empty - \def\@oddfoot{\footnotesize\itshape - Preprint submitted to \ifx\@journal\@empty Elsevier - \else\@journal\fi\hfill\today}% + \def\@oddfoot + {\hbox to \textwidth% + {\ifnopreprintline\relax\else + \@myfooterfont% + \ifx\@elsarticlemyfooteralign\@elsarticlemyfooteraligncenter% + \hfil\@elsarticlemyfooter\hfil% + \else% + \ifx\@elsarticlemyfooteralign\@elsarticlemyfooteralignleft% + \@elsarticlemyfooter\hfill{}% + \else% + \ifx\@elsarticlemyfooteralign\@elsarticlemyfooteralignright% + {}\hfill\@elsarticlemyfooter% + \else% + Preprint submitted to \ifx\@journal\@empty% + Elsevier% + \else\@journal\fi\hfill\@date\fi% + \fi% + \fi% + \fi% + } + }% \let\@evenfoot\@oddfoot} - \def\@seccntDot{.} \def\@seccntformat#1{\csname the#1\endcsname\@seccntDot\hskip 0.5em} @@ -588,8 +1209,9 @@ \@ifundefined{@biboptions}{\xdef\@biboptions{numbers}}{} \InputIfFileExists{\jobname.spl}{}{} -\RequirePackage[\@biboptions]{natbib} - +\ifnonatbib\relax\else + \RequirePackage[\@biboptions]{natbib} +\fi \newwrite\splwrite \immediate\openout\splwrite=\jobname.spl \def\biboptions#1{\def\next{#1}\immediate\write\splwrite{% @@ -597,7 +1219,6 @@ ,\expandafter\strip@prefix\meaning\next}}} \let\baselinestretch=\@blstr - \ifnum\jtype=1 \RequirePackage{geometry} \geometry{twoside, @@ -622,9 +1243,9 @@ textheight=622pt, textwidth=468pt, centering, - headheight=50pt, + headheight=50pt, headsep=12pt, - footskip=12pt, + footskip=18pt, footnotesep=24pt plus 2pt minus 12pt, columnsep=2pc } @@ -653,7 +1274,6 @@ %% End of option '5p' %% \fi\fi\fi - \def\journal#1{\gdef\@journal{#1}} \let\@journal\@empty \newenvironment{frontmatter}{}{\maketitle} @@ -695,7 +1315,65 @@ \@makeother\= }{}} %% +\def\appendixname{Appendix } +\renewcommand\appendix{\par + \setcounter{section}{0}% + \setcounter{subsection}{0}% + \setcounter{equation}{0} + \gdef\thefigure{\@Alph\c@section.\arabic{figure}}% + \gdef\thetable{\@Alph\c@section.\arabic{table}}% + \gdef\thesection{\appendixname~\@Alph\c@section}% + \@addtoreset{equation}{section}% + \gdef\theequation{\@Alph\c@section.\arabic{equation}}% + \addtocontents{toc}{\string\let\string\numberline\string\tmptocnumberline}{}{} +} + +%%%% \numberline width calculation for appendix. +\newdimen\appnamewidth +\def\tmptocnumberline#1{% + \setbox0=\hbox{\appendixname} + \appnamewidth=\wd0 + \addtolength\appnamewidth{2.5pc} + \hb@xt@\appnamewidth{#1\hfill} +} + +%% Added for work with amsrefs.sty + +\@ifpackageloaded{amsrefs}% + {} + {%\let\bibsection\relax% + \AtBeginDocument{\def\cites@b#1#2,#3{% + \begingroup[% + \toks@{\InnerCite{#2}#1}% + \ifx\@empty#3\@xp\@gobble\fi + \cites@c#3% +}}} +%% +%% Added for avoiding clash with cleveref.sty +\@ifpackageloaded{cleveref}% + {} + {\def\tnotetext[#1]#2{\g@addto@macro\@tnotes{% + \refstepcounter{tnote}% + \immediate\write\@auxout{\string\Newlabel{#1}{\thetnote}} + \def\thefootnote{\ifcase\c@tnote\or$\star$\or$\star\star$\fi}% + \footnotetext{#2}}} +%%% + \def\fntext[#1]#2{\g@addto@macro\@fnotes{% + \refstepcounter{fnote}% + \immediate\write\@auxout{\string\Newlabel{#1}{\thefnote}} + \def\thefootnote{\thefnote}% + \global\setcounter{footnote}{\c@fnote}% + \footnotetext{#2}}} +%%% + \def\cortext[#1]#2{\g@addto@macro\@cornotes{% + \refstepcounter{cnote}% + \immediate\write\@auxout{\string\Newlabel{#1}{\thecnote}} + \def\thefootnote{\ifcase\c@cnote\or$\ast$\or + $\ast\ast$\fi}% + \footnotetext{#2}}} +} +\def\textmarker#1#2{\textcolor{#1}{#2}}%*% \endinput %% %% End of file `elsarticle.cls'. diff --git a/inst/rmarkdown/templates/elsevier/skeleton/elsevier-harvard-without-titles.csl b/inst/rmarkdown/templates/elsevier/skeleton/elsevier-harvard-without-titles.csl deleted file mode 100644 index 58c2b820f..000000000 --- a/inst/rmarkdown/templates/elsevier/skeleton/elsevier-harvard-without-titles.csl +++ /dev/null @@ -1,242 +0,0 @@ - - diff --git a/inst/rmarkdown/templates/elsevier/skeleton/elsevier-harvard.csl b/inst/rmarkdown/templates/elsevier/skeleton/elsevier-harvard.csl deleted file mode 100644 index 5089861d1..000000000 --- a/inst/rmarkdown/templates/elsevier/skeleton/elsevier-harvard.csl +++ /dev/null @@ -1,239 +0,0 @@ - - diff --git a/inst/rmarkdown/templates/elsevier/skeleton/elsevier-vancouver.csl b/inst/rmarkdown/templates/elsevier/skeleton/elsevier-vancouver.csl deleted file mode 100644 index 9c3a8167b..000000000 --- a/inst/rmarkdown/templates/elsevier/skeleton/elsevier-vancouver.csl +++ /dev/null @@ -1,163 +0,0 @@ - - diff --git a/inst/rmarkdown/templates/elsevier/skeleton/elsevier-with-titles-alphabetical.csl b/inst/rmarkdown/templates/elsevier/skeleton/elsevier-with-titles-alphabetical.csl deleted file mode 100644 index f7cfc01fc..000000000 --- a/inst/rmarkdown/templates/elsevier/skeleton/elsevier-with-titles-alphabetical.csl +++ /dev/null @@ -1,134 +0,0 @@ - - diff --git a/inst/rmarkdown/templates/elsevier/skeleton/elsevier-with-titles.csl b/inst/rmarkdown/templates/elsevier/skeleton/elsevier-with-titles.csl deleted file mode 100644 index a87a81e09..000000000 --- a/inst/rmarkdown/templates/elsevier/skeleton/elsevier-with-titles.csl +++ /dev/null @@ -1,149 +0,0 @@ - - diff --git a/inst/rmarkdown/templates/elsevier/skeleton/elsevier-without-titles.csl b/inst/rmarkdown/templates/elsevier/skeleton/elsevier-without-titles.csl deleted file mode 100644 index f22af3864..000000000 --- a/inst/rmarkdown/templates/elsevier/skeleton/elsevier-without-titles.csl +++ /dev/null @@ -1,125 +0,0 @@ - - diff --git a/inst/rmarkdown/templates/elsevier/skeleton/mybibfile.bib b/inst/rmarkdown/templates/elsevier/skeleton/mybibfile.bib index b88149fc9..4305f969c 100644 --- a/inst/rmarkdown/templates/elsevier/skeleton/mybibfile.bib +++ b/inst/rmarkdown/templates/elsevier/skeleton/mybibfile.bib @@ -1,12 +1,12 @@ -@article{Dirac1953888, - title = "The lorentz transformation and absolute time", +@article{Dirac1953888, + title = "The {Lorentz} transformation and absolute time", journal = "Physica ", volume = "19", number = "1-–12", pages = "888--896", year = "1953", doi = "10.1016/S0031-8914(53)80099-6", - author = "P.A.M. Dirac" + author = "P. A. M. Dirac" } @article{Feynman1963118, @@ -16,5 +16,5 @@ @article{Feynman1963118 pages = "118--173", year = "1963", doi = "10.1016/0003-4916(63)90068-X", - author = "R.P Feynman and F.L {Vernon Jr.}" + author = "R. P Feynman and F. L {Vernon Jr.}" } diff --git a/inst/rmarkdown/templates/elsevier/skeleton/numcompress.sty b/inst/rmarkdown/templates/elsevier/skeleton/numcompress.sty deleted file mode 100644 index b187effb0..000000000 --- a/inst/rmarkdown/templates/elsevier/skeleton/numcompress.sty +++ /dev/null @@ -1,189 +0,0 @@ -%% -%% This is file 'numcompress'. -%% -%% Copyright (C) 2009-2012 River Valley Technologies -%% -%% -%% This package may be distributed under the terms of the LaTeX Project -%% Public License, as described in lppl.txt in the base LaTeX distribution. -%% Either version 1.0 or, at your option, any later version. -%% -%% $Id: numcompress.sty 187 2012-08-18 09:36:35Z rishi $ -%% $URL: http://lenova.river-valley.com/svn/elsbst/trunk/numcompress.sty $ -%% -\NeedsTeXFormat{LaTeX2e} -\def\Fileversion$#1: #2 ${\gdef\fileversion{#2}} -\def\Filedate$#1: #2-#3-#4 #5 #6 #7 ${\gdef\filedate{#2/#3/#4}} -\Fileversion$Rev: 187 $ -\Filedate$LastChangedDate: 2012-08-18 15:06:35 +0530 (Sat, 18 Aug 2012) $ -\ProvidesPackage{numcompress} - [\filedate\space\fileversion\space numcompress (CVR)] -\PackageWarningNoLine{numcompress} - {****************************************\MessageBreak - Package numcompress v,\fileversion\space loaded\MessageBreak - [Compress numbers (CVR)]\MessageBreak - ****************************************} -\newif\ifdots \dotsfalse -\newif\ifnumcompress \numcompresstrue - -\DeclareOption{dots}{\global\dotstrue} -\DeclareOption{nodots}{\global\dotsfalse} -\DeclareOption{compress}{\global\numcompresstrue} -\DeclareOption{nocompress}{\global\numcompressfalse} - -\ProcessOptions - -\def\removeDot#1{\def\tmp{#1}% - \ifx\tmp\@empty\else\@removeDot#1\@nil\fi} - -\def\@removeDot#1\@nil{\edef\fchar{\expandafter\@car#1\@nil}% - \edef\rchar{\expandafter\@cdr#1!\@nil}% - \def\@xmltempa{.}\def\@xmltempb{!}% - \ifx\fchar\@xmltempb\relax\else% - \ifx\fchar\@xmltempa\relax\else% - \fchar\ignorespaces\fi\removeDot{\rchar}\fi} - -\def\First[#1]{\csname First#1\endcsname} -\def\Second[#1]{\csname Second#1\endcsname} - -\def\parseFirstPage#1{\@tempcnta=0 - \@tfor\@digits:=#1\do{% - {\global\advance\@tempcnta by 1 - \expandafter\xdef\csname - First\the\@tempcnta\endcsname{\@digits}% - \xdef\flength{\the\@tempcnta}}}} - -\def\parseSecondPage#1{\@tempcnta=0 - \@tfor\@digits:=#1\do{% - {\global\advance\@tempcnta by 1 - \expandafter\xdef\csname - Second\the\@tempcnta\endcsname{\@digits}% - \xdef\llength{\the\@tempcnta}}}} - -\newif\ifdissimilar\dissimilarfalse -\def\checkequal#1#2{\edef\Farg{#1}\edef\Sarg{#2}% - \edef\One{A}% - \ifcat\One\Farg \relax\else% - \ifdissimilar\Sarg\else% - \ifnum\Farg=\Sarg\relax\else\Sarg\dissimilartrue\fi\fi\fi} -% -\let\@@fpage\@empty -\let\@@lpage\@empty -\def\fpage@compress#1{% - \gdef\@@fpage{#1}% - \edef\llength{0}% - \parseFirstPage{#1}% - \ifnum\flength=\llength% - \gdef\@fpage{\@@fpage}% - \gdef\@lpage{% - \@ifundefined{Second1}{}{\checkequal{\First[1]}{\Second[1]}}% - \@ifundefined{Second2}{}{\checkequal{\First[2]}{\Second[2]}}% - \@ifundefined{Second3}{}{\checkequal{\First[3]}{\Second[3]}}% - \@ifundefined{Second4}{}{\checkequal{\First[4]}{\Second[4]}}% - \@ifundefined{Second5}{}{\checkequal{\First[5]}{\Second[5]}}% - }% - \else% - \gdef\@fpage{\@@fpage}% - \gdef\@lpage{\@@lpage}% - \fi} - -\def\lpage@compress#1{% - \gdef\@@lpage{#1}% - \parseSecondPage{#1}% - \ifnum\flength=\llength% - \gdef\@fpage{\@@fpage}% - \gdef\@lpage{% - \edef\One{A}% - \edef\xFirst{\First[1]}% - \edef\xSecond{\Second[1]}% - \ifcat\One\xSecond\relax% - \ifx\xFirst\xSecond% - \@ifundefined{Second1}{}{\checkequal{\First[1]}{\Second[1]}}% - \@ifundefined{Second2}{}{\checkequal{\First[2]}{\Second[2]}}% - \@ifundefined{Second3}{}{\checkequal{\First[3]}{\Second[3]}}% - \@ifundefined{Second4}{}{\checkequal{\First[4]}{\Second[4]}}% - \@ifundefined{Second5}{}{\checkequal{\First[5]}{\Second[5]}}% - \else#1\fi% - \else% - \ifx\xFirst\xSecond% - \@ifundefined{Second1}{}{\checkequal{\First[1]}{\Second[1]}}% - \@ifundefined{Second2}{}{\checkequal{\First[2]}{\Second[2]}}% - \@ifundefined{Second3}{}{\checkequal{\First[3]}{\Second[3]}}% - \@ifundefined{Second4}{}{\checkequal{\First[4]}{\Second[4]}}% - \@ifundefined{Second5}{}{\checkequal{\First[5]}{\Second[5]}}% - \else#1\fi% - \fi% - }% - \else - \gdef\@fpage{\@@fpage}% - \gdef\@lpage{% - \edef\Targ{#1}% - \edef\One{A}% - \edef\xFirst{\First[1]}% - \edef\xSecond{\Second[1]}% - \ifx\xFirst\xSecond - \ifcat\One\xSecond\relax\else\@@lpage\fi% - \else#1\fi% - }% - \fi} - -%\newwrite\xx -%\immediate\openout\xx=tmpbib.tex -\gdef\@@lpage@compress#1--#2\@nil{\lpage@compress{#1}} -\gdef\@@@pages#1#2{\def\next{#2}% -% \immediate\write\xx{[\the\c@NAT@ctr.]\space [#1][#2]}% - \fpage@compress{#1}%\ifx\next\@empty\relax\else - \@@lpage@compress#2\@nil%\fi - {\@fpage\ifx\next\@empty\relax\else - --\@lpage\fi}\resetall} - -\gdef\@@@page#1{#1\resetall} - -\def\mk@empty#1{\@tempcnta=1 - \loop\ifnum\@tempcnta<6 - \expandafter\let\csname#1\the\@tempcnta\endcsname\relax - \advance\@tempcnta by 1 \repeat} -\def\resetall{\let\@lpage\@empty\let\@fpage\@empty - \def\flength{0}\def\llength{0}% - \let\@@fpage\@empty\let\@@lpage\@empty - \mk@empty{First}\mk@empty{Second}} - - -\ifdots - \gdef\xfnm[#1]{\unskip\space#1} - \def\bibinfo#1#2{\@ifnextchar.{\@@bibinfo{#1}{#2}}{\@@@bibinfo{#1}{#2}}} - \def\@@@bibinfo#1#2{\def\next{#1}% - \def\@@@pg{pages}\def\@@@au{author}% - \ifx\next\@@@pg\bibpages{#2}\else - \ifx\next\@@@au\bibauthor{#2}\else - #2\fi\fi} - \def\@@bibinfo#1#2.{\def\next{#1}% - \def\@@@pg{pages}\def\@@@au{author}% - \ifx\next\@@@pg\bibpages{#2}.\else - \ifx\next\@@@au\bibauthor{#2}\else - #2.\fi\fi} -\else - \gdef\xfnm[#1]{\unskip\space\removeDot{#1}} - \def\bibinfo#1#2{\def\next{#1}% - \def\@@@pg{pages}\def\@@@au{author}% - \ifx\next\@@@pg\bibpages{#2}\else - \ifx\next\@@@au\bibauthor{#2}\else - #2\fi\fi} -\fi - -\ifnumcompress - \def\bibpages#1{\@@bibpages#1--\\\@nil} - \def\@@bibpages#1--#2\@nil{% - \ifx\\#2\relax\@@@page{#1}\else - \@@@pages{#1}{#2}\fi} - \else - \def\bibpages#1{#1} -\fi - -\def\bibauthor#1{#1} - -\endinput - -%% -%% End of package 'numcompress.sty' -%% diff --git a/inst/rmarkdown/templates/elsevier/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/elsevier/skeleton/skeleton.Rmd index a09d8768c..a80a04c44 100644 --- a/inst/rmarkdown/templates/elsevier/skeleton/skeleton.Rmd +++ b/inst/rmarkdown/templates/elsevier/skeleton/skeleton.Rmd @@ -4,6 +4,7 @@ author: - name: Alice Anonymous email: alice@example.com affiliation: Some Institute of Technology + correspondingauthor: true footnote: 1 - name: Bob Security email: bob@example.com @@ -23,87 +24,90 @@ address: address: Department, Street, City, State, Zip footnote: - code: 1 - text: "Corresponding Author" + text: "This is the first author footnote." - code: 2 - text: "Equal contribution" + text: "Another author footnote." abstract: | This is the abstract. It consists of two paragraphs. - +keywords: + - keyword1 + - keyword2 journal: "An awesome journal" date: "`r Sys.Date()`" +classoption: preprint, 3p, authoryear bibliography: mybibfile.bib -#linenumbers: true -#numbersections: true -csl: elsevier-harvard.csl -output: rticles::elsevier_article +linenumbers: false +numbersections: true +# Use a CSL with `citation_package = "default"` +# csl: https://www.zotero.org/styles/elsevier-harvard +output: + rticles::elsevier_article: + keep_tex: true + citation_package: natbib --- -_Text based on elsarticle sample manuscript, see [http://www.elsevier.com/author-schemas/latex-instructions#elsarticle](http://www.elsevier.com/author-schemas/latex-instructions#elsarticle)_ - - -The Elsevier article class -========================== - -#### Installation +Please make sure that your manuscript follows the guidelines in the +Guide for Authors of the relevant journal. It is not necessary to +typeset your manuscript in exactly the same way as an article, +unless you are submitting to a camera-ready copy (CRC) journal. -If the document class *elsarticle* is not available on your computer, -you can download and install the system package *texlive-publishers* -(Linux) or install the LaTeX package *elsarticle* using the package -manager of your TeX installation, which is typically TeX Live or MikTeX. +For detailed instructions regarding the elsevier article class, see -#### Usage +# Bibliography styles -Once the package is properly installed, you can use the document class -*elsarticle* to create a manuscript. Please make sure that your -manuscript follows the guidelines in the Guide for Authors of the -relevant journal. It is not necessary to typeset your manuscript in -exactly the same way as an article, unless you are submitting to a -camera-ready copy (CRC) journal. - -#### Functionality - -The Elsevier article class is based on the standard article class and -supports almost all of the functionality of that class. In addition, it -features commands and options to format the +Here are two sample references: @Feynman1963118 [@Dirac1953888]. -- document style +By default, natbib will be used with the `authoryear` style, set in `classoption` variable in YAML. +You can sets extra options with `natbiboptions` variable in YAML header. Example +```yaml +natbiboptions: longnamesfirst,angle,semicolon +``` -- baselineskip +There are various more specific bibliography styles available at +. +To use one of these, add it in the header using, for example, `biblio-style: model1-num-names`. -- front matter +## Using CSL -- keywords and MSC codes +If `citation_package` is set to `default` in `elsevier_article()`, then pandoc is used for citations instead of `natbib`. In this case, the `csl` option is used to format the references. Alternative `csl` files are available from . These can be downloaded +and stored locally, or the url can be used as in the example header. -- theorems, definitions and proofs +# Equations -- lables of enumerations +Here is an equation: +$$ + f_{X}(x) = \left(\frac{\alpha}{\beta}\right) + \left(\frac{x}{\beta}\right)^{\alpha-1} + e^{-\left(\frac{x}{\beta}\right)^{\alpha}}; + \alpha,\beta,x > 0 . +$$ -- citation style and labeling. +Here is another: +\begin{align} + a^2+b^2=c^2. +\end{align} -Front matter -============ +Inline equations: $\sum_{i = 2}^\infty\{\alpha_i^\beta\}$ -The author names and affiliations could be formatted in two ways: +# Figures and tables -(1) Group the authors per affiliation. +Figure \ref{fig2} is generated using an R chunk. -(2) Use footnotes to indicate the affiliations. +```{r fig2, fig.width = 5, fig.height = 5, fig.align='center', out.width="50%", fig.cap = "\\label{fig2}A meaningless scatterplot.", echo = FALSE} +plot(runif(25), runif(25)) +``` -See the front matter of this document for examples. You are recommended -to conform your choice to the journal you are submitting to. +# Tables coming from R -Bibliography styles -=================== +Tables can also be generated using R chunks, as shown in Table \ref{tab1} for example. -There are various bibliography styles available. You can select the -style of your choice in the preamble of this document. These styles are -Elsevier styles based on standard styles like Harvard and Vancouver. -Please use BibTeX to generate your bibliography and include DOIs -whenever available. +```{r tab1, echo = TRUE} +knitr::kable(head(mtcars)[,1:4], + caption = "\\label{tab1}Caption centered above table" +) +``` -Here are two sample references: @Feynman1963118 [@Dirac1953888]. +# References {-} -References {#references .unnumbered} -========== diff --git a/man/article.Rd b/man/article.Rd index b06e1dcfc..906d0425a 100644 --- a/man/article.Rd +++ b/man/article.Rd @@ -81,7 +81,8 @@ ctex(..., template = "default", latex_engine = "xelatex") elsevier_article( ..., keep_tex = TRUE, - md_extensions = c("-autolink_bare_uris") + md_extensions = c("-autolink_bare_uris"), + citation_package = "natbib" ) frontiers_article(..., keep_tex = TRUE) @@ -244,6 +245,8 @@ function \code{ctex} is an alias of \code{ctex_article}. Format for creating submissions to Elsevier journals. Adapted from \url{https://www.elsevier.com/authors/policies-and-guidelines/latex-instructions}. + +It requires a minimum version of 2.10 for Pandoc. } \section{\code{frontiers_article}}{ diff --git a/tests/testit/test-formats.R b/tests/testit/test-formats.R index b61e86d4b..d57af9f25 100644 --- a/tests/testit/test-formats.R +++ b/tests/testit/test-formats.R @@ -43,7 +43,7 @@ test_format("bioinformatics") test_format("biometrics") test_format("copernicus") test_format("ctex", skip = !xfun::is_linux()) # only on linux due to fonts requirements -test_format("elsevier") +test_format("elsevier", skip = !rmarkdown::pandoc_available("2.10")) test_format("frontiers") test_format("glossa") test_format("ieee")