Ensuring two different gt tables have the same width (e.g., full page width or other custom length) in quarto pdf

I am currently building a report using Quarto and it needs rendering into pdf. In said report i have, amidst text, two tables with descriptives. One of the tables occupies the full length of the page while the other, which is immediately below, has a shorter width.

I am wondering if there is a specific Quarto code chunk option or gttable option that allows one to customise a table so it occupies the full width of the page?

Any help would be much appreciated.


  • So that future users may learn about what support gt offers for PDF:

    • See this post where user rich_i explains why that gt has more limited compatibility for styling under LaTeX (PDF) output.

    • See the bookdown documentation where it states, "Currently gt mainly supports HTML output"

    • In the same bookdown documentation, there are numerous alternatives, with the closest suggestion being gtsummary (see its github page), which allegedley has better LaTex support

    • My personal choice (for now) is the kableExtra package which I feel has enough good features for PDF output. See a manual in using it with LaTeX here. Applied to the current question, it has features like "scale_down", "full_width", and others that may get you the results you want.

    To put it simply, gt() may produce great tables, but the formatting in PDF may not be easy. Workarounds will likely involve some decent knowledge of LaTeX and configuring its figure environments.