1

I'm producing a pdf document with rmarkdown.

I produce a table with the following code:

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)

The output looks like this:

enter image description here

I'd really like to make the 2nd column b more visible, ideally by increasing font size of that column only, thus increasing the size of the arrows. Is this possible or are there alternative ways to produce the same effect?

Mark Davies
  • 787
  • 5
  • 18
  • Can you make a compilable [mre]? – samcarter_is_at_topanswers.xyz Nov 11 '21 at 15:03
  • Does [this](https://stackoverflow.com/a/67265919/13249862) answer your question? – bttomio Nov 11 '21 at 16:48
  • no that answer is to increase size of caption. @samcarter_is_at_topanswers.xyz MWE with YAML inserted. Thanks – Mark Davies Nov 14 '21 at 14:33
  • If you're open to using a different package, my `huxtable` does this like `set_font_size(everywhere, "b", 14)` where `"b"` is the column name. I'm not certain how font size plays with `\leftarrow` and friends; could be unicode and xetex would help here. – dash2 Nov 30 '21 at 10:57
  • @dash2 thanks. Do you know if `huxtable` is able to produced tables that span multiple pages, like `longtable`? – Mark Davies Nov 30 '21 at 20:41
  • You can use `longtable`, via `huxtable::table_environment`. It's not completely tested with it, though. You can also split tables easily using `huxtable::split_across`. Headers will be preserved on both sides of the split. – dash2 Nov 30 '21 at 21:52

1 Answers1

1

You can add your desired font size to your arrows:

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

enter image description here