【问题标题】:Kable caption in rmarkdown file in HTML in boldrmarkdown 文件中的 Kable 标题在 HTML 中以粗体显示
【发布时间】:2019-07-09 11:39:34
【问题描述】:

我想将表格标题设为粗体,但似乎找不到合适的选项。

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

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

输出是:

【问题讨论】:

    标签: r r-markdown kable kableextra


    【解决方案1】:

    这种面向降价的解决方案是否适合您?

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

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

    ```{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-output 这应该可以工作:

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

    【讨论】:

    • 当我将它通过管道传输到kable_styling时它不起作用。没有后者它可以工作......
    • 您能告诉我您的完整文件所需的输出格式是什么吗?
    • 是html,我用html_document
    • 太棒了!谢谢! results='asis' 是做什么的?它似乎没有...
    • 使用kable 没关系,你是对的。只有在代码块中生成 html 代码时,它的用法才真正相关。
    猜你喜欢
    • 2021-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-07
    • 2013-02-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多