r-markdown - kableExtra:更改表格脚注的字体大小
问题描述
我希望脚注中的字体大小小于表格中的文本,但无法弄清楚。是否有类似于 kable_styling 的东西,我可以在其中编辑可用于脚注的表格中行的文本和颜色?我正在使用 RMarkdown 生成 HTML 而不是 LateX。
---
title: "Untitled"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE )
library( kableExtra )
library( knitr )
```
```{r mtcars}
tab_mtcars <- knitr::kable( mtcars[ 1:5 , c( 1:4 )] , format = "html", col.names = c( "MPG", "CYL", "DISP" , "HP" ) , align = "lccc" , escape = F ) %>% kable_styling( full_width = T , bootstrap_options = c( "hover", "condensed" , "bordered"), position = "left") %>% add_header_above( c( "mtcars example" = 5 ) , bold = TRUE ) %>% footnote( general = c( "Here is the footnote where I would like font smaller than above" ), general_title = "Note: ", footnote_as_chunk = T )
```
`r tab_mtcars`
解决方案
您可以<small>
将文本中的 html 标记用于函数的general
和general_title
参数kabaleExtra::footnote
。参见示例:
tab_mtcars <-
knitr::kable(
mtcars[1:5 , c(1:4)] ,
format = "html",
col.names = c("MPG", "CYL", "DISP" , "HP") ,
align = "lccc" ,
escape = F
) %>%
kable_styling(
full_width = T ,
bootstrap_options = c("hover", "condensed" , "bordered"),
position = "left"
) %>% add_header_above(c("mtcars example" = 5) , bold = TRUE) %>% footnote(
general = c(
"<small>Here is the footnote where I would like font smaller than above</small>"
),
general_title = "<small>Note: </small>",
footnote_as_chunk = T ,
escape = F
)
推荐阅读
- amazon-web-services - Iam 权限与资源权限
- postgresql - 由于 VPN 会话关闭而失去与服务器的连接时,避免取消 postgresql 脚本
- python - 在 Python 中使用字段解决钻石问题的最佳方法
- html - 如何在不向我的 HTML 添加类或 id 的情况下设置元素的样式?
- objective-c - 如何为现有的 Objective-C git 工作指定 SPM 的版本
- sql - 如何从多个日期内的计数中获取 pl/sql 的平均值
- reactjs - useState React 传递颜色
- java - 在 Tomcat 10.x 上部署 Spring 5.x
- flutter - Flutter - 对带有模型的图表使用 API
- git - 如何克隆到 git 存储库中的特定标签,而不包括该标签之后的历史记录或提交?