diff --git a/DESCRIPTION b/DESCRIPTION index 322555903..e691a8dbf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: rticles Title: Article Formats for R Markdown -Version: 0.27.10 +Version: 0.27.11 Authors@R: c( person("JJ", "Allaire", , "jj@posit.co", role = "aut"), person("Yihui", "Xie", , "xie@yihui.name", role = "aut", diff --git a/NEWS.md b/NEWS.md index e5be27f29..3d80869b4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -36,6 +36,8 @@ supported by the `copernicus.cls`, and fix an issue where the section headers we ## MINOR CHANGES +- Patch `WileyNDJ` template used in `sim_article()` to fix an issue with `etex` package not being useful anymore in recent LaTeX distributions (#593). + - Update all templates to work with Pandoc 3.2.1 by adding the definition of new `\pandocbounded` command used by Pandoc's LaTeX writers (see more at https://github.com/jgm/pandoc/releases/tag/3.2.1 and https://github.com/jgm/pandoc/issues/9660) (#571, #576). # rticles 0.27 diff --git a/inst/rmarkdown/templates/sim/resources/template.tex b/inst/rmarkdown/templates/sim/resources/template.tex index 98c7b4fc1..0e58440e7 100644 --- a/inst/rmarkdown/templates/sim/resources/template.tex +++ b/inst/rmarkdown/templates/sim/resources/template.tex @@ -1,4 +1,4 @@ -\documentclass[AMA,STIX1COL$for(classoption)$,$classoption$$endfor$]{WileyNJD-v5} +\documentclass[AMA,Times1COL$for(classoption)$,$classoption$$endfor$]{WileyNJD-v5} $if(longtable)$ \usepackage{longtable} diff --git a/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIX-Bold.otf b/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIX-Bold.otf deleted file mode 100644 index 0b3011b22..000000000 Binary files a/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIX-Bold.otf and /dev/null differ diff --git a/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIX-BoldItalic.otf b/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIX-BoldItalic.otf deleted file mode 100644 index f7407e315..000000000 Binary files a/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIX-BoldItalic.otf and /dev/null differ diff --git a/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIX-Italic.otf b/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIX-Italic.otf deleted file mode 100644 index b79db47fe..000000000 Binary files a/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIX-Italic.otf and /dev/null differ diff --git a/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIX-Regular.otf b/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIX-Regular.otf deleted file mode 100644 index 2b76eb2cb..000000000 Binary files a/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIX-Regular.otf and /dev/null differ diff --git a/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIXMath-Regular.otf b/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIXMath-Regular.otf deleted file mode 100644 index 1865a1068..000000000 Binary files a/inst/rmarkdown/templates/sim/skeleton/Fonts/Stix/STIXMath-Regular.otf and /dev/null differ diff --git a/inst/rmarkdown/templates/sim/skeleton/WileyNJD-v5.cls b/inst/rmarkdown/templates/sim/skeleton/WileyNJD-v5.cls index 70af76980..e768b6e49 100644 --- a/inst/rmarkdown/templates/sim/skeleton/WileyNJD-v5.cls +++ b/inst/rmarkdown/templates/sim/skeleton/WileyNJD-v5.cls @@ -352,8 +352,11 @@ \ProcessOptions \LoadClass[twoside,fleqn,onecolumn]{article}% -\usepackage{etex}% -\reserveinserts{28}% included etex package and \reserveinserts{...} to avoid no room for \newinserts, \newcounts or \newskips etc. +\usepackage{etex} +% Modification by as etex is not used anymore in modern LaTeX +\@ifundefined{reserveinserts}{}{% + \reserveinserts{28}% +} \RequirePackage{graphicx,multicol}% \RequirePackage{multirow}% \RequirePackage{cuted}% diff --git a/tests/testit/test-formats.R b/tests/testit/test-formats.R index b79b39521..c620cc7b3 100644 --- a/tests/testit/test-formats.R +++ b/tests/testit/test-formats.R @@ -10,8 +10,7 @@ test_format <- function(name, output_options = NULL, skip = NULL) { # work in a temp directory dir <- tempfile() dir.create(dir) - oldwd <- setwd(dir) - on.exit(setwd(oldwd), add = TRUE) + withr::local_dir(dir) # create a draft of the format testdoc <- paste0(name, "_article", ".Rmd") @@ -24,7 +23,7 @@ test_format <- function(name, output_options = NULL, skip = NULL) { "Rendering the ", name, " format...", if (!is.null(output_options)) " (with output options)" ) - output_file <- rmarkdown::render(testdoc, output_options = output_options, quiet = TRUE) + output_file <- rmarkdown::render(testdoc, output_options = output_options, quiet = !interactive()) assert(paste(name, "format works"), { file.exists(output_file) }) @@ -77,7 +76,7 @@ test_format("rjournal") test_format("rsos") test_format("rss") test_format("sage") -test_format("sim", skip = TRUE) # sim format currently broken +test_format("sim") test_format("springer", skip = !rmarkdown::pandoc_available("2.11.4")) test_format("tf", output_options = list(reference_style = "CAD")) test_format("tf", output_options = list(reference_style = "APA")) diff --git a/tools/create_wiley_cls_patch.R b/tools/create_wiley_cls_patch.R new file mode 100644 index 000000000..31ccc808c --- /dev/null +++ b/tools/create_wiley_cls_patch.R @@ -0,0 +1,13 @@ +# Save the patch file in tools folder +patch_file <- "tools/wiley-cls-etex-fix.patch" +# Apply the patch using processx +result <- processx::run("git", c("apply", patch_file), error_on_status = FALSE) + +if (result$status == 0) { + message("\nPatch applied successfully!") +} else { + message("\nFailed to apply patch:") + message(result$stderr) + message("\nYou can manually apply it with:") + message(" git apply ", patch_file) +} diff --git a/tools/wiley-cls-etex-fix.patch b/tools/wiley-cls-etex-fix.patch new file mode 100644 index 000000000..e9e93416e --- /dev/null +++ b/tools/wiley-cls-etex-fix.patch @@ -0,0 +1,20 @@ +diff --git a/inst/rmarkdown/templates/sim/skeleton/WileyNJD-v5.cls b/inst/rmarkdown/templates/sim/skeleton/WileyNJD-v5.cls +index 70af769..3e61516 100644 +--- a/inst/rmarkdown/templates/sim/skeleton/WileyNJD-v5.cls ++++ b/inst/rmarkdown/templates/sim/skeleton/WileyNJD-v5.cls +@@ -352,8 +352,13 @@ + \ProcessOptions + \LoadClass[twoside,fleqn,onecolumn]{article}% + +-\usepackage{etex}% +-\reserveinserts{28}% included etex package and \reserveinserts{...} to avoid no room for \newinserts, \newcounts or \newskips etc. ++\usepackage{etex} ++%\ Modification by as etex is not used anymore in modern LaTeX ++\makeatletter ++\@ifundefined{reserveinserts}{}{% ++ \reserveinserts{28}% ++} ++\makeatother + \RequirePackage{graphicx,multicol}% + \RequirePackage{multirow}% + \RequirePackage{cuted}%