gpt4 book ai didi

Is a kable() col heading with side by side special symbols possible?(可以使用并排带有特殊符号的kable()标头吗?)

转载 作者:bug小助手 更新时间:2023-10-28 10:22:55 24 4
gpt4 key购买 nike



This is not a question about printing distinct kable() tables side by side.

这不是并排打印不同的kable()表的问题。


Working in Markdown, PDF output. I have a column heading that is the Greek symbol delta. I want to add a column the heading of which is the Greek symbol delta side-by-side with the % symbol, but I cannot figure out how to achieve this.

在Markdown中工作,PDF输出。我有一个列标题,它是希腊符号Delta。我想添加一列,其标题是希腊符号Delta和%符号并排,但我想不出如何实现这一点。


Here's what I've got:

以下是我得到的信息:


test_results <- dplyr::data_frame ('First Score'=c(42.35), 'Second Score'=c(90.4), '$\\Delta$'=c(48.05))

kable(test_results, align = "ccc", caption = "Test Results Data", format="latex", position = "h!", escape = FALSE) %>% row_spec(0,bold=TRUE) %>%
kable_styling()

Thanks for any help!

感谢您的任何帮助!


更多回答

where did you try adding the % symbol? I don't see it anywhere

您在哪里尝试添加%符号?我在任何地方都没看到它

Is this being used in an rmarkdown document?

这在rmarkdown文档中使用了吗?

@Peter yes, with PDF output.

@Peter是的,具有PDF输出。

@r2evans, I've nothing to show as I've no idea how to print the % side-by-side with the delta

@r2evans,我没有什么可展示的,因为我不知道如何将%与增量并排打印

I know that LaTeX doesn't like the % symbol by itself, do I'd think something like names(test_results)[3] <- "$\\Delta$\\%" would work.

我知道LaTeX本身不喜欢%符号,我认为像NAMES(TEST_RESULTS)[3]<-“$\\Delta$\\%”这样的符号会起作用吗?

优秀答案推荐

Not really sure where you want the % sign, so assuming it is required after the delta, try this.

不确定您想要%符号的位置,所以假设在增量之后需要它,试试这个。


```{r }

library(kableExtra)
library(tibble)

test_results <- tibble ('First Score'=c(42.35),
'Second Score'=c(90.4),
'$\\Delta$\\%'=c(48.05))

kable(test_results,
align = "ccc",
caption = "Test Results Data",
format="latex",
position = "h!",
escape = FALSE) |>
row_spec(0,bold=TRUE) |>
kable_styling()


```

Which gives:

这提供了:


enter image description here


更多回答

Perfect. Thank you, @Peter--I'm grateful.

完美无缺。“谢谢你,”彼得--我很感激。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com