vincentarelbundock / tinytable

Simple and Customizable Tables in `R`
https://vincentarelbundock.github.io/tinytable
GNU General Public License v3.0
196 stars 16 forks source link

maybe fixes typst group label alignment (#323) #338

Closed arbelt closed 1 week ago

arbelt commented 2 weeks ago

I could very well be missing something, but it doesn't seem like nhead (which I'm assuming is # of header rows?) should be in the row offset for typst tables?

vincentarelbundock commented 2 weeks ago

Thanks a lot for looking at this. Unfortunately, this particular fix will break other things.

I'll be looking at this soon.

arbelt commented 2 weeks ago

Got it — thanks!

Out of curiosity, what does it break? In my brief look-through, it seemed like nhead basically kept track of column groupings, and all the header stuff I could tell was in the table.header before the "// tinytable cell content after line". This change still worked with multiple layers of column headers, so just wondering what I missed, or if I misunderstood the nhead.

vincentarelbundock commented 2 weeks ago

lol, I can't even reproduce it now, but I swear there was something ;)

In any case, there are many things to fix with Typst: more compact styling functions, styling single cells twice doesn't work, and then the indexing thing. To fix all this, I need a near complete re-write of that portion of the code. It's underway here but real-work is crazy right now, so I'm not sure when it'll be merged: https://github.com/vincentarelbundock/tinytable/pull/339

vincentarelbundock commented 1 week ago

Here's an example of breakage. The Brie group is not indented properly.

# Issue #139
tab <- tt(mtcars[1:10, 1:5]) |>
  group_tt(i = list("Feta" = 2, "Brie" = 6)) |>
  group_tt(j = list("First" = 2:3, "Second" = 4:5)) |>
  style_tt(1:5, align = "c", background = "blue", color = "white")
tab
vincentarelbundock commented 1 week ago

Sooo, your fix was correct, but there was a different bug in the indenting code.

Should be fixed in the main branch now.

Thanks @arbelt !