-
Notifications
You must be signed in to change notification settings - Fork 214
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
Issue 1465 #1495
Conversation
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.
Thank you so much for submitting this PR! I'll review this PR pretty soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@kbrevoort Before merging, could you fill out the CLA? |
@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. |
@kbrevoort @rich-iannone - I'm just bumping this because it seems the only thing holding it up is accepting the contributor license agreement(?) |
Summary
This pull request addresses two previously-reported bugs associated with outputting tables to LaTeX.
cols_width()
Produces an Error When Usingpct()
inside It in LaTeX/PDF Output #1465: Fixes an issue where table columns specified with thepct
function cause LaTeX compilation errors. The error is caused by the fact that specifyingcols_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.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
cols_width()
Produces an Error When Usingpct()
inside It in LaTeX/PDF Output #1465Checklist
testthat
unit tests totests/testthat
for any new functionality.