From 8478c444660b38bc9ebda2bca375a1ff507160fa Mon Sep 17 00:00:00 2001 From: Sergio Oller Date: Sat, 11 Jul 2026 08:29:43 +0200 Subject: [PATCH 1/2] Fix counter needed in pandoc 3.8.2 and later pandoc<3.8.1 works pandoc==3.8.1 does not work pandoc>=3.8.2 works 3.8.2 was released one week after 3.8.1 See jgm/pandoc#11201 and rstudio/rticles#595 --- inst/rmd/latex/default-2.8.tex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inst/rmd/latex/default-2.8.tex b/inst/rmd/latex/default-2.8.tex index 7700056..ac49189 100644 --- a/inst/rmd/latex/default-2.8.tex +++ b/inst/rmd/latex/default-2.8.tex @@ -278,6 +278,7 @@ \newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}} \newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1} $endif$ +\newcounter{none} % pandoc 3.8.1 and later uses a counter for unnamed tables. $for(header-includes)$ $header-includes$ @@ -331,6 +332,7 @@ \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ $endif$ + $for(include-after)$ $include-after$ From 5a373885f5a927a08f484fea7dccb34e62b75120 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 11 Jul 2026 06:20:11 +0000 Subject: [PATCH 2/2] Add regression test for uncaptioned tables under pandoc >=3.8.1 (#116) Renders the pipe-table reprex from Bioconductor/BiocStyle#116 through BiocStyle::pdf_document with lualatex. Without the fix in inst/rmd/latex/default-2.8.tex, compilation fails with "! LaTeX Error: No counter '' defined." on pandoc >=3.8.1 (jgm/pandoc#11201). --- inst/unitTests/test_pdf_document.R | 35 +++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/inst/unitTests/test_pdf_document.R b/inst/unitTests/test_pdf_document.R index 478cfb5..988a0da 100644 --- a/inst/unitTests/test_pdf_document.R +++ b/inst/unitTests/test_pdf_document.R @@ -2,9 +2,42 @@ test_pdf_document <- function() { filename <- rmarkdown::draft(tempfile(fileext = ".Rmd"), edit = FALSE, template="pdf_document", package = "BiocStyle") lines <- BiocStyle:::readUTF8(filename) - lines <- BiocStyle:::modifyLines(lines, from = "title:", replace = FALSE, + lines <- BiocStyle:::modifyLines(lines, from = "title:", replace = FALSE, insert='subtitle: "Vignette Subtitle"') BiocStyle:::writeUTF8(lines, filename) rmarkdown::render(filename) unlink(filename) } + +test_pdf_document_uncaptioned_table <- function() { + ## Regression test for https://github.com/Bioconductor/BiocStyle/issues/116 + ## + ## Starting with pandoc 3.8.1, an uncaptioned table is typeset by emitting + ## a reference to a LaTeX counter which avoids incrementing the regular + ## 'table' counter. BiocStyle's frozen copy of the pandoc LaTeX template + ## did not define that counter, causing compilation to fail with + ## "! LaTeX Error: No counter '' defined." (see jgm/pandoc#11201). + rmd <- c( + '---', + 'title: "Uncaptioned table"', + 'output:', + ' BiocStyle::pdf_document:', + ' latex_engine: lualatex', + '---', + '', + 'An uncaptioned Markdown pipe table, with no R code involved at all:', + '', + '| File type | Suggested function |', + '| ----------| ---------------------- |', + '| CSV | `readr::read_csv()` |', + '| TSV | `readr::read_tsv()` |', + '| SPSS | `haven::read_spss()` |', + '| xls/xlsx | `readxl::read_excel()` |' + ) + filename <- tempfile(fileext = ".Rmd") + writeLines(rmd, filename) + output_file <- tempfile(fileext = ".pdf") + rmarkdown::render(filename, output_file = output_file, quiet = TRUE) + checkTrue(file.exists(output_file)) + unlink(c(filename, output_file)) +}