Skip to content

Long table header repeated on each page. #1630

Closed

Description

@rjazwiec

Prework

Proposal

As far as I looked it in .tex files gt uses longtable environment for tables spanning over few pages.
Unfortunately, table headers are not repeated on each page.

I'm not LaTex pro, but I tested manually adding \endhead after \midrule before the first row of data, and each time it worked very well. Both for tables rendered in portrait and in landscape*.

I think it would be nice to have parameter in gt() that decides if \endhead should be added to latex output.

*package lscape

Activity

  1. rjazwiec commented on Apr 23, 2024

    @rjazwiec
    Author

    Sample result of manually adding \endhead rendered to pdf
    sample2.pdf

  2. bzkrouse commented on May 8, 2024

    @bzkrouse

    I agree this would be a very helpful addition!

  3. ujtwr commented on Oct 11, 2024

    @ujtwr

    I agree as well. Additionally, wouldn't it be useful if a label could be set at the top of the headers from the second page onward to indicate continuity, and that label could also be customizable?

    The attached screenshot is from the 'kableExtra' package. In this package, there is a 'repeat_header' option that, when enabled, adds the label '(continued)' above the header on the second and subsequent pages. However, this label cannot be changed. As a Japanese user, there are times when I would like to change the label to Japanese :-) .

    image

  4. iantaylor-NOAA commented on Apr 7, 2026

    @iantaylor-NOAA

    The latex.header_repeat = TRUE available since gt 1.1.0 (thanks to #1995 from @thebioengineer) solves this issue for me, so couldn't you close this issue (as well as #1982)? I got here by searching "how to make header repeat in gt long table" and was initially under the impression that the option wasn't yet available.

    I agree that the suggestion for a customizable addition to the header like "(continued)" as suggested by @ujtwr is a good one, but that seems like it belongs in a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions