Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tbl-subcap with LaTeX tables #10328

Closed
cscheid opened this issue Jul 18, 2024 Discussed in #10324 · 0 comments · Fixed by #10329
Closed

tbl-subcap with LaTeX tables #10328

cscheid opened this issue Jul 18, 2024 Discussed in #10324 · 0 comments · Fixed by #10329
Assignees
Labels
crossref enhancement New feature or request tables Issues with Tables including the gt integration
Milestone

Comments

@cscheid
Copy link
Collaborator

cscheid commented Jul 18, 2024

Minimal repro from keep-md: true:

---
format: pdf
keep-tex: true
---

::: {#tbl-example .cell layout-ncol="2" tbl-cap='Example' tbl-subcap='["Cars","Pressure"]'}

```{.r .cell-code}
library(tinytable)
tt(head(cars)) |> theme_tt("tabular") |> 
  save_tt("latex") |> knitr::asis_output()
```

::: {.cell-output-display}
```{=latex}
\begin{tabular}{ll}
\hline
speed & dist \\ \hline
4 &  2 \\
4 & 10 \\
7 &  4 \\
7 & 22 \\
8 & 16 \\
9 & 10 \\
\hline
\end{tabular}
```
:::

```{.r .cell-code}
tt(head(pressure)) |> theme_tt("tabular")  |> 
  save_tt("latex") |> knitr::asis_output()
```

::: {.cell-output-display}
```{=latex}
\begin{tabular}{ll}
\hline
temperature & pressure \\ \hline
0 & 0.0002 \\
20 & 0.0012 \\
40 & 0.0060 \\
60 & 0.0300 \\
80 & 0.0900 \\
100 & 0.2700 \\
\hline
\end{tabular}
```
:::
:::

Discussed in #10324

Originally posted by vincentarelbundock July 18, 2024

Description

Hi,

Thanks for all your work on Quarto and on this forum!

When a package produces markdown tables, the tbl-subcap functionality works as expected. However, when the package produces a LaTeX table, there is no subcaption.

Is it possible for Quarto to support subcaptions in LaTeX tables as well?

I'd love to get some clarification on this.

  1. Are subcaptions only supported for markdown tables?
  2. Are there plans to extend support for LaTeX tables as well?

Thanks!

---
format: pdf
---

```{r}
#| label: tbl-example
#| tbl-cap: "Example"
#| tbl-subcap: 
#|   - "Cars"
#|   - "Pressure"
#| layout-ncol: 2

library(tinytable)
tt(head(cars)) |> save_tt("markdown") |> knitr::asis_output()
tt(head(pressure)) |> save_tt("markdown") |> knitr::asis_output()
```

This doesn't work:

library(tinytable)
tt(head(cars)) |> save_tt("latex") |> knitr::asis_output()
tt(head(pressure)) |> save_tt("latex") |> knitr::asis_output()
```</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crossref enhancement New feature or request tables Issues with Tables including the gt integration
Projects
None yet
1 participant