xhr489
xhr489

Reputation: 2349

Kable caption in rmarkdown file in HTML in bold

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:

enter image description here

Upvotes: 2

Views: 7848

Answers (1)

Max Teflon
Max Teflon

Reputation: 1800

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

Upvotes: 12

Related Questions