?(caption) added when trying to put gt tables into a quarto tabset with html output

119 Views Asked by At

I am using Quarto with HTML output. I want to create a tabset where each tab contains multiple tables. Upon rendering, I get ?(caption) at the bottom of my tables. This does not happen when I do not create a tabset.

I have tried various permutation of labels/captions/etc... but cannot seem to get the ?(caption) to go away.

Reproducible example below, followed by output.

---
title: "Test"
format: html
---

## Multiple Tables

```{r}
library(tidyverse)
library(gt)

t1 <- 
  gtcars |>
  dplyr::select(mfr, msrp) |>
  dplyr::slice(1:5) |>
  gt() |>
  tab_header(
    title = md("Data listing from **gtcars**"),
    subtitle = md("`gtcars` is an R dataset")
  ) |>
  tab_caption(caption ="tbl-t1")

t2 <- 
  gtcars |>
  dplyr::select(model, msrp) |>
  dplyr::slice(1:5) |>
  gt() |>
  tab_header(
    title = md("Data listing from **gtcars**"),
    subtitle = md("`gtcars` is an R dataset")
  ) |>
  tab_caption(caption = "tbl-t2")
```

```{r}
#| tbl-cap: "Two Tables"
#| tbl-cap-location: bottom
#| tbl-subcap: 
#|   - "mfr"
#|   - "model"
#| layout-ncol: 2
#| layout-nrow: 1
#| layout-valign: top
#| echo: false

t1
t2
```

:::{.panel-tabset}

#### Tab

```{r}
#| tbl-cap: "Two Tables"
#| tbl-cap-location: bottom
#| tbl-subcap: 
#|   - "mfr"
#|   - "model"
#| layout-ncol: 2
#| layout-nrow: 1
#| layout-valign: top
#| echo: false

t1
t2
```

:::

Output

0

There are 0 best solutions below