Skip to content

Fix LaTeX error caused by \midrule interference#1390

Merged
rich-iannone merged 4 commits intomasterfrom
latex-midrule-fix
Aug 1, 2023
Merged

Fix LaTeX error caused by \midrule interference#1390
rich-iannone merged 4 commits intomasterfrom
latex-midrule-fix

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
@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

Development

Successfully merging this pull request may close these issues.

Error knitting to PDF when table has (Intercept) in a row longtable + booktabs breaks on row starting with ( or [

1 participant