quarto-dev / quarto-dev/quarto-cli

Table prefix crossref removes left alignment of gtsummary footnotes

Open
#11,935 2 comments 0 reactions 2 assignees View on GitHub

@rich-iannone is already working on this.

Since Jan 23, 2025.

bug tables upstream
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

The footnotes generated at the bottom of a gtsummary table by e.g. tbl_summary() are left aligned by default. When using the tbl- prefix for cross-referencing the table caption, the footnotes become centered

Steps to reproduce
---
title: "Untitled"
execute: 
  echo: false
---

```{r}
#| label: load

library(gt)
library(gtsummary)
```

```{r}
#| label: example-1 
#| tbl-cap: "Caption without crossref"

trial |>
  select(age, grade, response) |>
  tbl_summary()
```

```{r}
#| label: tbl-example-2
#| tbl-cap: "Caption with Crossref but center aligned footnote"

trial |>
  select(age, grade, response) |>
  tbl_summary()
```

```{r}
#| label: tbl-example-3
#| tbl-cap: "Caption with correct Crossref"

trial |>
  select(age, grade, response) |>
  tbl_summary() |> 
  as_gt() |> 
  tab_style(style = cell_text(align = "left"),
            locations = cells_footnotes())
```

Expected behavior

Footnotes are left aligned when cross-referencing is used but I have to use additional formatting from package gt. This is the output from chunk tbl-example-3.
Image

Actual behavior

Footnotes are left aligned when no cross-referencing is used (output from example-1), but when cross-referencing is used footnotes are centre aligned (output from tbl-example-2).

Image Image
Your environment
  • IDE: RStudio/2024.12.0+467
  • macOS Sequoia 15.1
Quarto check output
Quarto 1.7.13
[✓] Checking environment information...
      Quarto cache location: /Users/derekchiu/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.7.13
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (external install)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/derekchiu/Library/TinyTeX/bin/universal-darwin
      Version: 2024

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
      Source: MacOS known location

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.13.1
      Path: /opt/homebrew/opt/python@3.13/bin/python3.13
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.4.2
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/derekchiu/Library/R/arm64/4.4/library
        - /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
      knitr: 1.49
      rmarkdown: 2.29

[✓] Checking Knitr engine render......OK

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.