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"))