为什么上标不使用 kable extra 从 r-markdown 以 pdf 格式显示?

why superscript not displaying in pdf from r-markdown using kable extra?

我正在尝试使用 excel 通过符号来读取上标。它显示在块中,但在生成 pdf 时上标未显示。

我正在阅读 excel 如下所示的文件

Col
-----
word${^1}$
word${^1}$
word${^1}$
word${^1}$
word${^1}$
word${^1}$

dput(head(df))
structure(list(Col = c("word${^1}$", "word${^1}$", "word${^1}$", 
"word${^1}$", "word${^1}$", "word${^1}$")), row.names = c(NA, 
-6L), class = c("tbl_df", "tbl", "data.frame"))
df<-read_excel("../suprscript.xlsx", sheet = 'sheet1')

kbl(df,longtable = T) %>%
kable_styling(latex_options = c("hold_position","repeat_header"),full_width = F)

上标在 markdown 中显示在 运行 块上,但在 pdf 中显示为

word${^1}$

调用 kableExtra::kbl 时使用 escape=F 选项,如以下 .Rmd 文件。

---
title: "Mathematical symbols in tables"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(knitr)
library(kableExtra)
```

```{r}
df <- structure(list(Col = c("word${^1}$", "word${^1}$", 
"word${^1}$", 
"word${^1}$", "word${^1}$", "word${^1}$")), row.names = c(NA, 
-6L), class = c("tbl_df", "tbl", "data.frame"))
result <- 
    kbl(df,longtable = T, escape=F) %>%
    kable_styling(latex_options = 
        c("hold_position","repeat_header"),full_width = F)
result
```

这是生成的 PDF 的屏幕截图。