1

For html_document or pdf_document, there have been solutions to suppress automatic table name and number, [for example,] (How to suppress automatic table name and number in an .Rmd file using xtable or knitr::kable?).
However, adding the following in the YAML section

header-includes:
    - \usepackage{caption}

and the following before the code chunk

\captionsetup[table]{labelformat=empty}

does not work for html_document2.
Knitted from the following .rmd file, the automatic table name and number "Table 1.1: " cannot be disabled in the output html file. Thanks in advance for help!

---
title: "Suppress automatic table name and number"
author: Generated by bookdown
output:
  bookdown::html_document2: default
header-includes:
    - \usepackage{caption}
---
# https://bookdown.org/yihui/rmarkdown-cookbook/cross-ref.html

\captionsetup[table]{labelformat=empty}

```{r myirischunk, results = 'asis', tab.cap = NULL, echo = TRUE}
print(knitr::kable(head(iris), caption = "Table 1.a - First own table name"))

print(knitr::kable(tail(iris), caption = "Table 1.b - Last own table name"))

   
bdedu
  • 383
  • 1
  • 8
  • If the toolchain is to go Rmd -> LaTeX -> HTML, then it would be surprising that this doesn't work. Unfortunately I'm not intimately familiar how the toolchain for making HTML goes, but if it's not using LaTeX, I doubt importing a LaTeX package would work. – Roman Luštrik Jun 01 '22 at 16:42
  • 1
    Thanks! I tried [pander](https://stackoverflow.com/questions/45651426/no-table-numbering-with-pander-in-bookdownhtml-document2). It seems to work. – bdedu Jun 01 '22 at 17:17

0 Answers0