四分位表交叉引用GT
---
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")
```
Does anyone know of a solution or perhaps im doing something wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是四分之一的问题,现在已经解决了
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.