四分位表交叉引用GT

发布于 2025-01-29 01:59:34 字数 1141 浏览 3 评论 0原文

 ---
title: "example"
format: 
  pdf: 
    documentclass: article
editor: visual
---

大家好,我有一个简单的问题,这使我发疯:我想使用标题由GT表创建的表格交叉引用。这是我的设置:

     ```{r}
library(tidyverse)
library(gt)
tbl_1 <- tribble(~x, ~y,
                 1, 2,
                 3, 4)

      ```

说我想从tbl_1创建一个表,然后稍后交叉引用。这是我的尝试:

```{r}
#| label: tbl-table-1
#| tbl-cap: "table 1"

tbl_1 %>% gt()
```

这给了我:

compilation failed- error
Package array Error:  Illegal pream-token (\caption): `c' used.

See the array package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.227 \caption
              {\label{tbl-table-1}table 1 } 

see example.log for more information.   

如果我在GT函数中使用标题参数,那就什么也没有。

```{r}
#| label: tbl-table-1
tbl_1 %>% gt(caption = "table 1")

```

结果

有人知道解决方案还是我在做错问题?

 ---
title: "example"
format: 
  pdf: 
    documentclass: article
editor: visual
---

Hello everyone i have a simple problem which is driving me crazy: I want cross reference a table created by a gt table using a caption. Here is my setup:

     ```{r}
library(tidyverse)
library(gt)
tbl_1 <- tribble(~x, ~y,
                 1, 2,
                 3, 4)

      ```

And lets say i want to create a table from tbl_1 and cross reference it later. Here is my attempt:

```{r}
#| label: tbl-table-1
#| tbl-cap: "table 1"

tbl_1 %>% gt()
```

This gives me:

compilation failed- error
Package array Error:  Illegal pream-token (\caption): `c' used.

See the array package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.227 \caption
              {\label{tbl-table-1}table 1 } 

see example.log for more information.   

And if i use the caption argument in the gt function it gives me nothing.

```{r}
#| label: tbl-table-1
tbl_1 %>% gt(caption = "table 1")

```

result

Does anyone know of a solution or perhaps im doing something wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄荷→糖丶微凉 2025-02-05 01:59:34

这是四分之一的问题,现在已经解决了
https://github.com/quarto-dev/quarto-dev/quarto-cli/quarto-cli/issues/ 924

使用标题 gt 使用标题和交叉引用,如果您使用高于0.9.439的四分之一版本,请立即工作

,请注意,对于 gt 乳胶输出将完全符合四分之一的输出和功能。遵循 gt 发布将是最好知道何时进行改进的最好的。

This was an issue in Quarto that has been fixed now
https://github.com/quarto-dev/quarto-cli/issues/924

Using gt with caption and cross reference should work as espected now if you use Quarto version above 0.9.439

Note that there is still some improvement to be done to gt LaTeX output to be fully compliant with Quarto output and features. Following gt releases will be the best to know when those improvement will be made.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文