From ee80f38d1b9568b88abdff3ce5f0b1bfb78ab180 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 18 Mar 2024 12:54:49 +0100 Subject: [PATCH] Correctly pass `pandoc_args` between format function fixes #564 and fix support of joss_article() for pdf_book() in bookdown --- NEWS.md | 2 ++ R/joss_article.R | 18 +++++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/NEWS.md b/NEWS.md index 2a21fc28..93deb73a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # rticles (development version) +- `joss_article()` now correctly works as `base_format` for `bookdown::pdf_book()` (thanks, @mlysy, #564). + - `oup_article()` now supports also `acknowledgments` in addition to `acknowledgements` as the original OUP LaTeX template (thanks, @dmkaplan2000, #563). - Update resources for `copernicus_article()` to version 7.7 from 3 January 2024. diff --git a/R/joss_article.R b/R/joss_article.R index af951fed..5e03d554 100644 --- a/R/joss_article.R +++ b/R/joss_article.R @@ -19,13 +19,14 @@ joss_article <- function(journal = "JOSS", keep_md = TRUE, latex_engine = "xelatex", + pandoc_args = NULL, ...) { rmarkdown::pandoc_available("2.2", TRUE) - logo_path <- find_resource("joss", paste0(journal, "-logo.png")) - journalname <- ifelse(journal == "JOSS", - "Journal of Open Source Software", - "Journal of Open Source Education" + args <- list( + logo_path = find_resource("joss", paste0(journal, "-logo.png")), + journal_name = ifelse(journal == "JOSS", "Journal of Open Source Software", "Journal of Open Source Education"), + graphics = TRUE ) pdf_document_format( @@ -33,11 +34,6 @@ joss_article <- function(journal = "JOSS", latex_engine = latex_engine, citation_package = "default", keep_md = keep_md, - pandoc_args = c( - "-V", paste0("logo_path=", logo_path), - "-V", paste0("journal_name=", journalname), - "-V", "graphics=true" - ), - ... - ) + pandoc_args = c(pandoc_args, list_to_pandoc_variable_args(args)), + ...) }