## R version 4.4.1 (2024-06-14 ucrt)
## Platform: x86_64-w64-mingw32/x64
## Running under: Windows 11 x64 (build 22631)
## 
## Matrix products: default
## 
## 
## locale:
## [1] LC_COLLATE=Italian_Italy.utf8  LC_CTYPE=Italian_Italy.utf8   
## [3] LC_MONETARY=Italian_Italy.utf8 LC_NUMERIC=C                  
## [5] LC_TIME=Italian_Italy.utf8    
## 
## time zone: Europe/Rome
## tzcode source: internal
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] officer_0.6.6   flextable_0.9.6 lubridate_1.9.3 forcats_1.0.0  
##  [5] stringr_1.5.1   dplyr_1.1.4     purrr_1.0.2     readr_2.1.5    
##  [9] tidyr_1.3.1     tibble_3.2.1    ggplot2_3.5.1   tidyverse_2.0.0
## 
## loaded via a namespace (and not attached):
##  [1] sass_0.4.9              utf8_1.2.4              generics_0.1.3         
##  [4] fontLiberation_0.1.0    xml2_1.3.6              stringi_1.8.4          
##  [7] hms_1.1.3               digest_0.6.37           magrittr_2.0.3         
## [10] evaluate_0.24.0         grid_4.4.1              timechange_0.3.0       
## [13] bookdown_0.40           fastmap_1.2.0           jsonlite_1.8.8         
## [16] zip_2.3.1               fansi_1.0.6             scales_1.3.0           
## [19] fontBitstreamVera_0.1.1 textshaping_0.4.0       jquerylib_0.1.4        
## [22] cli_3.6.3               rlang_1.1.4             fontquiver_0.2.1       
## [25] munsell_0.5.1           withr_3.0.1             cachem_1.1.0           
## [28] yaml_2.3.10             gdtools_0.4.0           tools_4.4.1            
## [31] uuid_1.2-1              tzdb_0.4.0              colorspace_2.1-1       
## [34] vctrs_0.6.5             R6_2.5.1                lifecycle_1.0.4        
## [37] ragg_1.3.3              pkgconfig_2.0.3         pillar_1.9.0           
## [40] bslib_0.8.0             gtable_0.3.5            glue_1.7.0             
## [43] data.table_1.16.0       Rcpp_1.0.13             systemfonts_1.1.0      
## [46] xfun_0.47               tidyselect_1.2.1        rstudioapi_0.16.0      
## [49] knitr_1.48              htmltools_0.5.8.1       rmarkdown_2.28         
## [52] compiler_4.4.1          askpass_1.2.0           openssl_2.2.1

Table 1 with kable is working in both html & pdf

kableExtra::kable(tibble(variable= "hello", another = "bye"), caption = "The mtcars data.")
Table 1: The mtcars data.
variable another
hello bye

Table ?? with flextable in html in not working

ft <- flextable(head(airquality))
# ft <- set_caption(ft, "airquality dataset", 
#   autonum = run_autonum(seq_id = "tab", bkm = "airquality6"))
ft
``` ```{=html}
(\#tab:tab2)airquality dataset

Ozone

Solar.R

Wind

Temp

Month

Day

41

190

7.4

67

5

1

36

118

8.0

72

5

2

12

149

12.6

74

5

3

18

313

11.5

62

5

4

14.3

56

5

5

28

14.9

66

5

6