如何将匕首符号包含在Kable列标题中
我有一个RMD文件中的表格要打印到PDF,其中我需要在列标题中添加匕首符号。基本的测试代码是:
---
title: "Untitled"
author: "L. G. Hunsicker"
date: "4/29/2022"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = F)
library(magrittr)
library(knitr)
library(kableExtra)
```
```{r test}
df <- data.frame(x = 1:10)
names(df)[1] <- 'maxCpep (ng/mL) †'
df %>% kbl()
```
我已经尝试了几种方法来获取匕首符号打印,但是每次努力,结果是,匕首符号的代码被简单地打印为文本或引起错误(带有后斜线)。我尝试使用bquote,\匕首,\匕首等。我还尝试使用上标“ a”作为替代方案。同样,KBL仅在不替换所需符号的情况下打印文字代码文本。必须有一种直接的方式将特殊字符或数学字符串插入Kable标头中,但我找不到它。
在此先感谢您在此问题上的任何帮助。 拉里·亨西克(Larry Hunsicker)
I have a table in a Rmd file to print to pdf in which I need to add a dagger symbol into a column header. The basic test code is:
---
title: "Untitled"
author: "L. G. Hunsicker"
date: "4/29/2022"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = F)
library(magrittr)
library(knitr)
library(kableExtra)
```
```{r test}
df <- data.frame(x = 1:10)
names(df)[1] <- 'maxCpep (ng/mL) †'
df %>% kbl()
```
I have tried several ways to get the dagger symbol to print, but with each effort, the outcome is that the code for the dagger symbol is simply printed as text or raises an error (with the backslash). I have tried using bquote, \dagger, \dagger, etc. I also tried to use a superscript "a" as an alternative. Again, kbl just prints the literal code text without substituting the required symbol. There must be a straight-forward way to insert special characters or math strings into a kable header, but I have been unable to find it.
Thanks in advance for any help with this issue.
Larry Hunsicker
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以直接添加一个Unicode逃生:
You can directly add a Unicode escape:
使用
inttoutf8
获得特殊字符。Use
intToUtf8
to get the special character.