HTML中rmarkdown文件中的Kabel标题以粗体显示

时间:2019-07-09 11:39:34

标签: r r-markdown kable kableextra

我想用粗体显示表格标题,但似乎找不到它的选项。

我的代码是(在rmarkdown文档中):

kable(head(iris), caption = 'I want this in Bold') %>% 
  kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) 

输出为:

enter image description here

1 个答案:

答案 0 :(得分:2)

这个面向降价促销的解决方案对您有用吗?

```{r, results='asis'}
kable(head(iris), caption = '**I want this in Bold**') %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed","responsive"))
```

对于html-输出,这应该可以工作:

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

对于pdf-输出,这应该可以工作:

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