问题
I want to make my table caption in bold but can't seem to find the option for it.
My code is (in a rmarkdown document):
kable(head(iris), caption = 'I want this in Bold') %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
The output is:
回答1:
Does this markdown-oriented solution work for you?
```{r, results='asis'}
kable(head(iris), caption = '**I want this in Bold**') %>%
kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed","responsive"))
```
for html
-output this should work:
```{r, results='asis'}
kable(head(iris), caption = '<b>I want this in Bold</b>', format = 'html') %>%
kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed","responsive"))
```
for pdf
-output this should work:
```{r, results='asis'}
kable(head(iris), caption = '\\textbf{I want this in Bold}', format = 'latex') %>%
kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed","responsive"))
```
来源:https://stackoverflow.com/questions/56951752/kable-caption-in-rmarkdown-file-in-html-in-bold