-
Notifications
You must be signed in to change notification settings - Fork 410
Description
I have:
- searched the issue tracker for similar issues
- installed the latest version of Quarto CLI
- formatted my issue following the Bug Reports guide
Bug description
Description: When rendering gt tables to PDF, they don't appear where placed in the document unless tbl-pos: "H" is
explicitly set
- Expected behavior: Tables should appear at their document position by default (or at least match the fig-pos: "H"
setting already in the YAML) - Workaround: Adding #| tbl-pos: "H" to each table chunk
It is worth noting that the document already has fig-pos: "H" in the YAML header for figures, but there's no
equivalent default for tables.
title: "gt Table Float Issue"
format:
pdf:
documentclass: report
---
## Section One
This is some text before the table.
```{r}
library(gt)
library(tibble)
tibble(
A = c("X", "Y", "Z"),
B = c(1, 2, 3),
C = c(4, 5, 6)
) |>
gt() |>
tab_header(title = "My Table")
This text should appear immediately after the table, but in the PDF
the table floats to a different location.
Section Two
More content here.
**Expected Behavior:**
The table should appear between "This is some text before the table" and "This text should appear immediately after the
table" - matching its position in the source document.
**Actual Behavior:**
The table floats to the top of the page or a different page entirely, separating it from the surrounding text.
**Workaround:**
Adding `#| tbl-pos: "H"` to the code chunk forces the table to stay in position:
```r
#| tbl-pos: "H"
Notes:
- The fig-pos: "H" YAML option works for figures but there's no equivalent default for tables
- This appears to be specific to gt tables in PDF output; HTML output positions correctly
- Tested with Quarto 1.x and gt packageSteps to reproduce
No response
Actual behavior
No response
Expected behavior
No response
Your environment
No response
Quarto check output
Quarto 1.8.24
[✓] Checking environment information...
Quarto cache location: /Users/tareef/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.6.3: OK
Dart Sass version 1.87.0: OK
Deno version 2.3.1: OK
Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.8.24
Path: /Applications/quarto/bin
[✓] Checking tools....................OK
TinyTeX: v2024.07.03
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /Users/tareef/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.12.8
Path: /Users/tareef/.pyenv/versions/3.12.8/bin/python3
Jupyter: 5.7.2
Kernels: python3
(|) Checking Jupyter engine render....Traceback (most recent call last):
File "/Applications/quarto/share/jupyter/jupyter.py", line 20, in
from notebook import notebook_execute, RestartKernel
File "/Applications/quarto/share/jupyter/notebook.py", line 19, in
import nbformat
ModuleNotFoundError: No module named 'nbformat'
WARN: Should not have arrived here: