You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LaTeX tables: column spanner widths are affected by order of the input data #1922
If there is already a relevant issue, whether open or closed, comment on the existing thread instead of posting a new issue.
Description
First, thank you for all the recent efforts to improve LaTeX capabilities! This issue is somewhat related to #1656.
For tables with a stub and column spanners, the column spanner's width is influenced by the order of the input data.
Reproducible example
[correct behavior] For the table below, the order of the data columns matches the order of the table columns. Widths are correctly set when rendered to latex:
library(gt)
gtcars |>
dplyr::select(mfr, model, year, trim) |>
dplyr::slice(1:10) |>
gt(rowname_col = "mfr") |>
cols_width(
mfr ~ pct(55),
model ~ pct(15),
year ~ pct(15),
trim ~ pct(15)
) |>
tab_spanner(
label = "a spanner",
columns = c(year, trim)
)
However, if we move mfr (row label) to the last column in the data, the spanner incorrectly inherits the width of the stub column:
gtcars |>
dplyr::select(model, year, trim, mfr) |>
dplyr::slice(1:10) |>
gt(rowname_col = "mfr") |>
cols_width(
mfr ~ pct(55),
model ~ pct(15),
year ~ pct(15),
trim ~ pct(15)
) |>
tab_spanner(
label = "a spanner",
columns = c(year, trim)
)
Expected result
I would expect the spanner widths to be independent of the order of the input data. Tables without spanners and/or stubs seem to work fine regardless of the order of the input data.
Activity
olivroy commentedon Nov 15, 2024
Yes, there are a couple of issues with borders + stub in LaTeX, like #1864. @kbrevoort I wonder if you were able to make progress on the issue?