Skip to content

Commit

Permalink
group_tt nhead adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Sep 14, 2024
1 parent 2349573 commit 5a5cb5d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion R/group_typst.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ group_typst_row <- function(x, i, indent, ...) {
tab <- c(top, mid, bot)
tab <- paste(tab, collapse = "\n")
x@table_string <- tab
idx_new <- i + seq_along(i) - 1
idx_new <- i + seq_along(i) + x@nhead - 2
idx_old <- setdiff(seq_len(nrow(x)), idx_new)
x <- style_tt(x, idx_old, indent = indent)
return(x)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,51 +44,51 @@ block[ // start block
(y: 12, x: 4, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 11, x: 4, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 10, x: 4, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 9, x: 4, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 8, x: 4, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 7, x: 4, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 6, x: 4, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 5, x: 4, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 4, x: 4, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 3, x: 4, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 2, x: 4, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 13, x: 3, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 12, x: 3, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 11, x: 3, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 10, x: 3, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 9, x: 3, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 8, x: 3, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 7, x: 3, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 6, x: 3, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 5, x: 3, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 4, x: 3, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 3, x: 3, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 2, x: 3, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 13, x: 2, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 12, x: 2, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 11, x: 2, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 10, x: 2, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 9, x: 2, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 8, x: 2, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 7, x: 2, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 6, x: 2, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 5, x: 2, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 4, x: 2, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 3, x: 2, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 2, x: 2, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 13, x: 1, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 12, x: 1, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 11, x: 1, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 10, x: 1, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 9, x: 1, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 8, x: 1, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 7, x: 1, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 6, x: 1, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 5, x: 1, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 4, x: 1, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 3, x: 1, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 2, x: 1, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 13, x: 0, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 12, x: 0, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 11, x: 0, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 10, x: 0, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 9, x: 0, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 8, x: 0, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 7, x: 0, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 6, x: 0, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 5, x: 0, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 4, x: 0, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 3, x: 0, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 2, x: 0, color: black, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: 1em),
(y: 6, x: 4, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: false),
(y: 5, x: 4, color: white, underline: false, italic: false, bold: false, mono: false, strikeout: false, fontsize: 1em, indent: false),
Expand Down
4 changes: 0 additions & 4 deletions inst/tinytest/test-typst.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ options(tinytable_print_output = "typst")


# semi complicated
# Q
# pkgload::load_all()
tab <- tt(mtcars[1:4, 1:5], caption = "Hello World") |>
group_tt(j = list("Group 1" = 4:5, "Group 2" = 2:3)) |>
style_tt(j = 1:5, align = "lcccr") |>
style_tt(i = 2, j = 1:3, strikeout = TRUE, bold = TRUE, background = "black", color = "white") |>
style_tt(j = 1, color = "red", italic = TRUE)
# print(tab)

expect_snapshot_print(tab, label = "typst-complicated")


Expand Down

0 comments on commit 5a5cb5d

Please sign in to comment.