Proposal
When a table is converted to LaTeX the column labels are only printed on the first page of output. If the table extends onto subsequent pages, only the data rows are show. It would be handy to have an option to include headers and/or column labels at the top of each page. In the longtable environment, this is fairly simply done by adding \endhead at the end of what is considered the table header.
For example, here's a random table of numbers that spans two pages in LaTeX:
library(tidyverse)
library(gt)
random <- tibble(
id = seq(1:50),
random = runif(50)
)
t <- gt(random) %>%
as_latex() %>%
as.character()
The raw TeX (t) is:
\\begin{longtable}{rr}\n\\toprule\nid & random \\\\ \n\\midrule\n1 & 0.26041117 \\\\ \n2 & 0.78843314 \\\\ \n...
The top of the second page looks like this when the TeX is rendered to PDF:

If \\endhead\n is placed just after \\midrule\n in the raw output, the table will be rendered with the "id" and "random" headers on each page.
Like this:

I took a quick look at the code and it seems like this could be added to latex_heading_row and/or latex_group_row of R/utils_render_latex.R, but I'm not sure how options might get passed in here and there would be some additional logic to handle the placement of \endhead when there's both gt headers and column labels.
Maybe similar to #194
Proposal
When a table is converted to LaTeX the column labels are only printed on the first page of output. If the table extends onto subsequent pages, only the data rows are show. It would be handy to have an option to include headers and/or column labels at the top of each page. In the
longtableenvironment, this is fairly simply done by adding\endheadat the end of what is considered the table header.For example, here's a random table of numbers that spans two pages in LaTeX:
The raw TeX (
t) is:The top of the second page looks like this when the TeX is rendered to PDF:
If
\\endhead\nis placed just after\\midrule\nin the raw output, the table will be rendered with the "id" and "random" headers on each page.Like this:
I took a quick look at the code and it seems like this could be added to
latex_heading_rowand/orlatex_group_rowofR/utils_render_latex.R, but I'm not sure how options might get passed in here and there would be some additional logic to handle the placement of\endheadwhen there's both gt headers and column labels.Maybe similar to #194