From f04523fedb1ebc7057e40cfbd8a25cb26d9ecbd4 Mon Sep 17 00:00:00 2001 From: Sergio Oller Date: Sun, 2 Jun 2024 19:31:33 +0200 Subject: [PATCH] Restore out.format to its former value out.format needs to be set for knit_theme$get(thm) to work. However, when building a pkgdown article based on a vignette that uses BiocStyle::pdf_document, the out.format is forced to be html, and hardcoding this knit option clashes with pkgdown. By setting and restoring the output format, things keep working as expected --- R/pdf_document.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/pdf_document.R b/R/pdf_document.R index 06ca48e..2c00dd0 100644 --- a/R/pdf_document.R +++ b/R/pdf_document.R @@ -80,12 +80,14 @@ pdf_document <- function(toc = TRUE, ## code chunks and code highlighting thm <- system.file("themes", "default.css", package = "BiocStyle") - opts_knit$set(out.format="latex"); + out_fmt <- opts_knit$get("out.format") + opts_knit$set(out.format="latex") head = c(head, "% code highlighting", knit_theme$get(thm)$highlight, readLines(file.path(resources, "tex", "highlighting-macros.def"))) - + opts_knit$set(out.format=out_fmt) + if (use_unsrturl) head = c(head, sprintf("\\AtBeginDocument{\\bibliographystyle{%s}}\n", sub(".bst$", "", template_files[["bst"]])))