提高可见性/增加 table 中一列的字体大小:使用 kableextra 生成的 pdf 输出
Improve visibility/ Increase font size of one column in table: pdf output produced with kableextra
我正在使用 rmarkdown 生成 pdf 文档。
我使用以下代码生成 table:
YAML:
---
title: "Queries"
header-includes:
- \usepackage{pdflscape}
- \usepackage{longtable}
- \usepackage{xcolor}
output:
pdf_document:
toc: false
latex_engine: xelatex
mainfont: Arial
---
{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(dplyr)
library(kableExtra)
library(stringr)
library(readxl)
{r query}
df <- data.frame(a = rep("text", 3),
b = c("\uparrow", " \leftrightarrow", "\downarrow"),
c = rep(" lots more text ...", ))
df%>%
kbl(longtable = FALSE, escape = F, booktabs = T, align = "c")%>%
column_spec(1, width = "8em")%>%
column_spec(3, width = "9em")%>%
column_spec(2, bold = TRUE, color = "red")%>%
kable_styling(font_size = 8)
输出如下所示:
我真的很想让第 2 列 b
更显眼,最好是 仅增加该列的字体大小 ,从而增加箭头的大小.这是可能的还是有其他方法可以产生相同的效果?
您可以为箭头添加所需的字体大小:
---
title: "Queries"
header-includes:
- \usepackage{pdflscape}
- \usepackage{longtable}
- \usepackage{xcolor}
output:
pdf_document:
toc: false
latex_engine: lualatex
keep_tex: true
mainfont: Arial
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(dplyr)
library(kableExtra)
library(stringr)
library(readxl)
```
```{r query}
df <- data.frame(a = rep("text", 3),
b = c("\LARGE\uparrow", " \LARGE\leftrightarrow", "\LARGE\downarrow"),
c = rep(" lots more text ...", ))
df%>%
kbl(longtable = FALSE, escape = F, booktabs = T, align = "c")%>%
column_spec(1, width = "8em")%>%
column_spec(3, width = "9em")%>%
column_spec(2, bold = TRUE, color = "red")%>%
kable_styling(font_size = 8)
```
我正在使用 rmarkdown 生成 pdf 文档。
我使用以下代码生成 table:
YAML:
---
title: "Queries"
header-includes:
- \usepackage{pdflscape}
- \usepackage{longtable}
- \usepackage{xcolor}
output:
pdf_document:
toc: false
latex_engine: xelatex
mainfont: Arial
---
{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(dplyr)
library(kableExtra)
library(stringr)
library(readxl)
{r query}
df <- data.frame(a = rep("text", 3),
b = c("\uparrow", " \leftrightarrow", "\downarrow"),
c = rep(" lots more text ...", ))
df%>%
kbl(longtable = FALSE, escape = F, booktabs = T, align = "c")%>%
column_spec(1, width = "8em")%>%
column_spec(3, width = "9em")%>%
column_spec(2, bold = TRUE, color = "red")%>%
kable_styling(font_size = 8)
输出如下所示:
我真的很想让第 2 列 b
更显眼,最好是 仅增加该列的字体大小 ,从而增加箭头的大小.这是可能的还是有其他方法可以产生相同的效果?
您可以为箭头添加所需的字体大小:
---
title: "Queries"
header-includes:
- \usepackage{pdflscape}
- \usepackage{longtable}
- \usepackage{xcolor}
output:
pdf_document:
toc: false
latex_engine: lualatex
keep_tex: true
mainfont: Arial
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(dplyr)
library(kableExtra)
library(stringr)
library(readxl)
```
```{r query}
df <- data.frame(a = rep("text", 3),
b = c("\LARGE\uparrow", " \LARGE\leftrightarrow", "\LARGE\downarrow"),
c = rep(" lots more text ...", ))
df%>%
kbl(longtable = FALSE, escape = F, booktabs = T, align = "c")%>%
column_spec(1, width = "8em")%>%
column_spec(3, width = "9em")%>%
column_spec(2, bold = TRUE, color = "red")%>%
kable_styling(font_size = 8)
```