Strip kableExtra's inline font-size override from table captions
kable_styling(font_size = ...) adds an inline
"font-size: initial !important;" to table captions, which no stylesheet
rule can override, leaving them at the browser default size while figure
captions get the template's 20pt. Remove the inline property via a small
script before </body> so the template's caption CSS applies. Runs in
browsers and in headless Chrome PDF printing alike.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Change-Id: If01351f62ec34a39a0a4ca4747f7e767207e3ebb
diff --git a/inst/rmarkdown/templates/posterdown_ids/resources/template.html b/inst/rmarkdown/templates/posterdown_ids/resources/template.html
index c848ef1..b2f094a 100644
--- a/inst/rmarkdown/templates/posterdown_ids/resources/template.html
+++ b/inst/rmarkdown/templates/posterdown_ids/resources/template.html
@@ -1310,5 +1310,14 @@
$include-after$
$endfor$
+<script>
+// kableExtra::kable_styling(font_size = ...) adds an inline
+// "font-size: initial !important;" to table captions, which no stylesheet
+// rule can override. Strip it so the template's caption styling applies.
+document.querySelectorAll("table caption").forEach(function (el) {
+ el.style.removeProperty("font-size");
+});
+</script>
+
</body>
</html>