-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set default font size to NA so tables inherit document font #1937
base: master
Are you sure you want to change the base?
Conversation
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. Fixes rstudio#1852.
I agree with the idea, but this requires a lot of manual testing.
We have to make sure we are still producing valid output! As an example, see what I did here to make sure I wasn't introducing new regression #1958 |
By manual testing, do you mean like the example with screenshots in your original post in #1958, showing the output in different cases? I did try to ensure there were unit tests and snapshots covering the font size options, but I can render some examples to different document formats if that's what you're looking for. |
I mean to ensure that output looks good in different formats, that LaTeX documents compile well!
Yes, that would be great. Also making sure that the correct table is shown if the option is set differently |
Okay, I made some test documents each with two tables, one at default size and one at a very large font size (so it's easy to tell if it worked). For example, the Rmd version:
Then I tested the following combinations:
I also tried labeling the second table as The outputs all looked reasonable. For instance, in Rnw there was no font size command in the first table (so it used the default), but there was Are there any other configurations to check, or would you like the test files? |
Summary
In LaTeX and HTML output formats, gt tables previously always set the font size (see #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.
Note I didn't see where the default font behavior is documented -- should this be added somewhere? Where?
Related GitHub Issues and PRs
Fixes #1852.
Checklist
testthat
unit tests totests/testthat
for any new functionality.