Skip to content
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

Fix LaTeX error caused by \midrule interference #1390

Merged
merged 4 commits into from Aug 1, 2023

Conversation

rich-iannone
Copy link
Member

@rich-iannone rich-iannone commented Aug 1, 2023

This PR solves an issue where some inputs following a \midrule are mistakenly interpreted as \midrule input. Previous to these changes, simple LaTeX tables would fail on certain characters following a midrule line. This set of examples (when rendered to PDF through any LaTeX engine) shows which cases render successfully and which fail.

# Works
gt::gt(data.frame(A = c("\u00A0(OK)", "sdf")))
gt::gt(data.frame('a' = c('OK', '(OK)'), 'b' = 1:2))
gt::gt(data.frame(B = "OK", A = "(OK)"))

# Fails
gt::gt(data.frame(A = "(BAD)"))
gt::gt(data.frame(A = paste0(knitr::asis_output("\u0028"), "BAD)")))
gt::gt(data.frame(A = "\u0028 BAD)"))
gt::gt(data.frame('a' = c('(BAD)', 'OK'), 'b' = 1:2))
gt::gt(data.frame(B = "(BAD)", A = "OK"))
gt::gt(data.frame(A = c("  (BAD)", "sdf")))

Which the changes made here, the previously failing cases now all work.

Fixes: #145
Fixes: #391

@netlify
Copy link

netlify bot commented Aug 1, 2023

Deploy Preview for quarto-gt-examples failed.

Name Link
🔨 Latest commit db476ba
🔍 Latest deploy log https://app.netlify.com/sites/quarto-gt-examples/deploys/64c96c29d1cc4d000897c7a1

@rich-iannone rich-iannone merged commit eb7a0eb into master Aug 1, 2023
13 of 18 checks passed
@rich-iannone rich-iannone deleted the latex-midrule-fix branch August 1, 2023 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant