Closed yimingli closed 7 years ago
Could you provide a minimal, self-contained, and reproducible example?
Oh, sorry about that. Here it is:
---
title: "Untitled"
output:
# knitr:::html_vignette
html_document
---
```{r}
library(printr)
# use the same data used in the printr vignette
set.seed(123)
x = matrix(rnorm(40), 5)
dimnames(x) = list(NULL, head(LETTERS, ncol(x)))
# further customization via kable(), e.g. digits and captions
knitr::kable(x, digits = 2, caption = 'A table produced by printr.')
I also tried to re-knit the `printr` introduction vignette to "normal" html instead of vignette html. The result is less pleasant than the vignette format.
Here is my environment:
sessionInfo()
Numbering figures/tables is the default feature of LaTeX. For knitr:::html_vignette
, it was implemented via JavaScript: https://github.com/yihui/knitr/blob/master/inst/misc/vignette.html Normally figures/tables won't be numbered in non-LaTeX output. If you want to number them, you may consider the bookdown package. See rstudio/bookdown#190 for more info.
Thanks. Any idea why the table caption is left aligned and size and color look funny when knitted to an html_document
? Is customizing css the only way to adjust it?
Perhaps Bootstrap defined that style for captions. You can certainly use CSS to customize the style.
Table numbering with table caption works for PDF and html_vignette format, but not for default html format. Also, the table caption is some light grey color, instead of black as in html_vignette format.