Skip to content

Cross-referenced longtable caption repeated on page break #14146

@mcanouil

Description

@mcanouil

Quarto injects the \caption and \label into the longtable, but places them before \endhead without adding a separate \endfirsthead block. This causes the caption to repeat on every page.

Discussed in https://github.com/orgs/quarto-dev/discussions/14145

Originally posted by jtatria March 3, 2026

Description

I'm trying t format a very long table with repeated headers in each page using gt with latex options longtable and header_repeat, but I'm getting repeated table captions on each page, and multiple entries in the list of tables.

How can I accomplish a long table with repeated headers but a single caption?

I already tried using gt's own gt:tab_caption, but the caption wouldn't show in quarto.

MRE:

---
title: "gt demo"
format:
  pdf:
    documentclass: report
    lot: true
---

## Demo

```{r}
#| label: tbl-demo
#| tbl-cap: "Caption repeats"
	gt::gt( iris ) |> gt::tab_options(
		latex.use_longtable=TRUE,
		latex.header_repeat=TRUE
	)
```
```
Screenshot_20260303_103723

Any help would be greatly appreciated. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    crossrefenhancementNew feature or requestlatexLaTeX engines related libraries and technologiestablesIssues with Tables including the gt integration

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions