kableExtra:更改 table 脚注的字体大小
kableExtra: Change font size of table footnote
我希望脚注中的字体大小小于 table 中的文字,但无法弄清楚。是否有类似于 kable_styling 的东西,我可以在其中编辑 table 中可用于脚注的行的文本和颜色?我正在使用 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`
据我所知,kable()
似乎没有办法控制它,因此您可以更改 CSS 样式。使用如下 YAML:
---
title: "Untitled"
output:
html_document:
css: style.css
---
和同一文件夹中的 style.css 文件包含一些 css 代码:
tfoot {
font-size: 80%;
}
您可以在 kabaleExtra::footnote
函数的 general
和 general_title
参数的文本中使用 html <small>
标记。参见示例:
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
)
我希望脚注中的字体大小小于 table 中的文字,但无法弄清楚。是否有类似于 kable_styling 的东西,我可以在其中编辑 table 中可用于脚注的行的文本和颜色?我正在使用 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`
据我所知,kable()
似乎没有办法控制它,因此您可以更改 CSS 样式。使用如下 YAML:
---
title: "Untitled"
output:
html_document:
css: style.css
---
和同一文件夹中的 style.css 文件包含一些 css 代码:
tfoot {
font-size: 80%;
}
您可以在 kabaleExtra::footnote
函数的 general
和 general_title
参数的文本中使用 html <small>
标记。参见示例:
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
)