Skip to content

Commit 79b8806

Browse files
authored
Merge pull request #2097 from thebioengineer/parbox_wrapping_text_columns
Parbox wrapping text columns
2 parents c053ab0 + 419d2b9 commit 79b8806

16 files changed

+548
-116
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: gt
33
Title: Easily Create Presentation-Ready Display Tables
4-
Version: 1.2.0.9000
4+
Version: 1.2.0.9001
55
Authors@R: c(
66
person("Richard", "Iannone", , "rich@posit.co", role = c("aut", "cre"),
77
comment = c(ORCID = "0000-0003-3925-190X")),

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# gt (development version)
22

3+
* Update how long text that has a line break or is horizontally aligned in a cell (stubs, labels, table body).
4+
35
# gt 1.2.0
46

57
* The new `fmt_number_si()` function format numeric values with SI prefixes and an optional unit (which could be also be obtained from a separate column), automatically selecting the appropriate prefix to keep the mantissa in a readable range (#1999). (#2060)

R/utils.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,12 @@ markdown_to_latex <- function(text, md_engine) {
11521152
}
11531153

11541154
if(grepl("..gt\\_linebreak\\_indicator..", x, fixed = TRUE)){
1155-
x <- paste0("\\shortstack[l]{" ,gsub("..gt\\_linebreak\\_indicator..", " \\\\", x, fixed = TRUE), "}")
1155+
## if there is a linebreak, wrap the text in a shortstack, and put it into a parbox that has the width set to linewidth
1156+
x <- paste0("\\shortstack[l]{" ,
1157+
parbox_wrapper(
1158+
gsub("..gt\\_linebreak\\_indicator..", " \\\\", x, fixed = TRUE),
1159+
"\\linewidth"),
1160+
"}")
11561161
}
11571162

11581163
x

0 commit comments

Comments
 (0)