rmarkdown 文件中的 Kable 标题以粗体显示在 HTML 中 [英] Kable caption in rmarkdown file in HTML in bold

查看:163
本文介绍了rmarkdown 文件中的 Kable 标题以粗体显示在 HTML 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to make my table caption in bold but can't seem to find the option for it.

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

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

输出为:

推荐答案

这个面向 Markdown 的解决方案适合你吗?

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

<小时>

对于 html-output 这应该可以工作:


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

<小时>

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


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

这篇关于rmarkdown 文件中的 Kable 标题以粗体显示在 HTML 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆