Skip to content

Issue 1465 #1495

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

Merged
merged 8 commits into from
Dec 18, 2023
Merged

Issue 1465 #1495

merged 8 commits into from
Dec 18, 2023

Conversation

kbrevoort
Copy link
Collaborator

Summary

This pull request addresses two previously-reported bugs associated with outputting tables to LaTeX.

  1. Issue cols_width() Produces an Error When Using pct() inside It in LaTeX/PDF Output #1465: Fixes an issue where table columns specified with the pct function cause LaTeX compilation errors. The error is caused by the fact that specifying cols_width(everything() ~ pct(20)) specifies the column width in LaTeX as "20%". Since % is the comment symbol in LaTeX, this produces a compilation error. The code has been changed so that the column width in LaTeX will be output as "0.2\linewidth" if the table width is unspecified (in which case each column will take up 20% of the available width) or 0.2 times the specified table width.
  2. Issue Specify width of LaTeX table #119 (and duplicate issue Table.width = pct(100) ignored in pdf #329): Uses the user-supplied table widths to establish the LaTeX tables widths. The code works with user-specified widths expressed as percentages (i.e., tab_options(table.width = pct(100))) or as specific units (i.e., tab_options(table.width = '400px')). Table widths are established using the specified LaTeX lengths \LTleft and \LTright. Extra space to fill out the table width, if necessary, is added in between the columns by setting `\extracolsep to \fill. (The code also creates two temporary length measures in LaTex, \holdLTleft and \holdLTright which record the existing length values of \LTleft and \LTright before setting them to the user-specified lengths for the table. After the longtable environment is ended, the preexisting values of \LTleft and \LTright are restored.

Related GitHub Issues and PRs

Checklist

Replaces the use of percentage symbols to express column widths, which cause an error when compiling Latex, with column widths that are expressed as a share of `\linewidth` or the user-supplied `table_width`.
Anchors LaTeX longtable to match a width set by the user.  Table width is achieved by changing the space between columns to produce a table that matches the specified width.
kbrevoort added a commit to kbrevoort/gt that referenced this pull request Nov 20, 2023
@rich-iannone rich-iannone self-requested a review November 23, 2023 16:06
@rich-iannone
Copy link
Member

Thank you so much for submitting this PR! I'll review this PR pretty soon.

Copy link
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rich-iannone
Copy link
Member

@kbrevoort Before merging, could you fill out the CLA?

@kbrevoort
Copy link
Collaborator Author

@rich-iannone, can you point me to where I can find the CLA? I haven't been able to figure out how to access it.

@briandk
Copy link

briandk commented Dec 17, 2023

@kbrevoort @rich-iannone - I'm just bumping this because it seems the only thing holding it up is accepting the contributor license agreement(?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants