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
Search for duplicates among the existing issues (both open and closed).
Proposal
#1594 made gt's LaTeX export respect more of the options/styles set in gt, including font size. Because the default gt font size is 12pt, every gt table rendered to LaTeX includes the following at the beginning:
\fontsize{12.0pt}{14.4pt}\selectfont
But default LaTeX document font sizes are typically 10pt or 11pt, so this makes the tables larger than the text. (Quarto uses scrartcl as the documentclass by default, which defaults to 11pt, for instance.)
As a user this is inconvenient in, say, a large Quarto book with many files, because I'd have to manually set the gt style options every time I load it, and keep those in sync if I adjust the LaTeX.
The change I meant to make was to handle cases where the user explicitly sets a table-wide font size using tab_options, such as gt1 <- gt(exibble) |> tab_options(table.font.size = px(16)), the as_latex function would change the font size to 12pt immediately before beginning the longtable environment. What I did not anticipate is that if the table was silent about the value of table.font.size, as in gt2 <- gt(exibble), or explicitly set to NULL as in gt3 <- gt(exibble) |> tab_options(table.font.size = NULL) (which is the default parameter value in the help file for tab_options) the value of table.font.size is set to the default value of 12pt. The code in the PR explicitly sets this value of table.font.size.
If that's what you want, I'll update the tests. But as a user, I think my preference would be that unless I explicitly set a value for table.font.size, the LaTeX code should remain silent about the font size used for the table and allow its value (and the other font characteristics) to be determined by the document where it appears.
If you want to go with the latter approach, it will require changing how the table.font.size parameter is stored in the gt_tbl object, which would have implications beyond the LaTeX portion of the code.
I actually would prefer the same logic being applied in other output formats, like HTML. The same thing happens in HTML output, but I only noticed it today because the default font size in Quarto's HTML output is close enough to 12pt that it's not a problem.
The text was updated successfully, but these errors were encountered:
This happens when rendering to revealjs as well, the tables are too small at 12px and need to be updated. I render to both html and revealjs (and docx) from the same quarto file, so it would be great if it would respect the default font size in each document. For this purpose, it seems to work so far to add tab_options(table.font.size = "100%") to each table, but that seems like it should be unnecessary.
In LaTeX and HTML output formats, gt tables previously always set the
font size (see rstudio#1594). If the tables were being inserted into a
document (e.g., in a Quarto document), they did not inherit the font
size of the surrounding document, requiring the user to manually set the
size option for each table.
Instead, the default table.font.size is NA. Leaving it NA causes the
HTML and LaTeX outputs to emit no font size change, so the table is the
same size as the surrounding text in the document (or the browser's
default body font size). If the user manually sets the table.font.size,
it will be respected in both formats.
Fixesrstudio#1852.
Prework
Proposal
#1594 made gt's LaTeX export respect more of the options/styles set in gt, including font size. Because the default gt font size is 12pt, every gt table rendered to LaTeX includes the following at the beginning:
But default LaTeX document font sizes are typically 10pt or 11pt, so this makes the tables larger than the text. (Quarto uses scrartcl as the documentclass by default, which defaults to 11pt, for instance.)
As a user this is inconvenient in, say, a large Quarto book with many files, because I'd have to manually set the gt style options every time I load it, and keep those in sync if I adjust the LaTeX.
Prior comment from @kbrevoort in #1594:
I actually would prefer the same logic being applied in other output formats, like HTML. The same thing happens in HTML output, but I only noticed it today because the default font size in Quarto's HTML output is close enough to 12pt that it's not a problem.
The text was updated successfully, but these errors were encountered: