#Table with merged cells

34 messages · Page 1 of 1 (latest)

vernal solar
#

I want a Table that look like this:

I got this so far, but I am not sure how to merge cells:

#

?r

= Sample Table <sample-table>
This document demonstrates a simple table with merged cells and improved formatting.

#figure(
  align(
    center,
  )[#table(
      columns: 6,
      align: (col, row) => (center, center, center, center, center, center,).at(col),
      inset: 6pt,
      [],
      [],
      [deltaX],
      [],
      [],
      [],
      [],
      [],
      [negative],
      [zero],
      [medium],
      [big],
      [velocity],
      [negative],
      [zero],
      [positive],
      [positive],
      [positive],
      [],
      [zero],
      [negative],
      [zero],
      [zero],
      [positive],
      [],
      [positive],
      [negative],
      [negative],
      [negative],
      [zero],
    )],
)
cursive bramble
#

Plain tables can't merge cells (yet), take a look at this:

iron patioBOT
vernal solar
#

alright I think that will do haha just need to figure out how

vernal solar
#

?r

#import "@preview/tablex:0.0.8": tablex, hlinex, vlinex, colspanx, rowspanx



#tablex(
  columns: 6,
  align: center + horizon,
  auto-vlines: true,
  repeat-header: true,

  colspanx(2)[], colspanx(4)[*deltaX*],
  colspanx(2)[], [*negative*], [*zero*], [*medium*], [*big*],
  
  rowspanx(3)[#rotate([*velocity*], -90deg)], 
  [*negative*], [_zero_], [_positive_], [_positive_], [_positiv_], 
  [*zero*], [_negative_], [_zero_], [_zero_], [_positive_],
  [*zero*], [_negative_], [_negative_], [_negative_], [_zero_], 
)

vernal solar
#

any Ideas how to get rid of the double cell top left

inner anchor
#

?r

#import "@preview/tablex:0.0.8": tablex, hlinex, vlinex, colspanx, rowspanx



#tablex(
  columns: 6,
  align: center + horizon,
  auto-vlines: true,
  repeat-header: true,
  
  hlinex(start: 2, end: 6),
  vlinex(start: 2, end: 5),
  colspanx(2)[], colspanx(4)[*deltaX*],
  hlinex(start: 2, end: 6),
  colspanx(2)[], [*negative*], [*zero*], [*medium*], [*big*],
  
  rowspanx(3)[#rotate([*velocity*], -90deg)], 
  [*negative*], [_zero_], [_positive_], [_positive_], [_positiv_], 
  [*zero*], [_negative_], [_zero_], [_zero_], [_positive_],
  [*zero*], [_negative_], [_negative_], [_negative_], [_zero_], 
)
vernal solar
#

uhh thanks

#

is it render bug that the line right below the empty cell is rendered thiner, or can I do something about it

#

?r

#import "@preview/tablex:0.0.8": tablex, hlinex, vlinex, colspanx, rowspanx, cellx

#tablex(
  columns: 6,
  align: center + horizon,
  auto-vlines: true,
  repeat-header: true,

  hlinex(start: 2, end: 6),
  vlinex(start: 2, end: 5),
  colspanx(2)[], colspanx(4, fill: gray)[*deltaX*],
  hlinex(start: 2, end: 6),
  colspanx(2)[], cellx(fill: silver)[*negative*], cellx(fill: silver)[*zero*], cellx(fill: silver)[*medium*], cellx(fill: silver)[*big*],
  
  rowspanx(3, fill: gray)[#rotate([*velocity*], -90deg)], 
  cellx(fill: silver)[*negative*], [_zero_], [_positive_], [_positive_], [_positiv_], 
  cellx(fill: silver)[*zero*], [_negative_], [_zero_], [_zero_], [_positive_],
  cellx(fill: silver)[*positive*], [_negative_], [_negative_], [_negative_], [_zero_], 
)

vernal solar
inner anchor
#

its because the fill is overlapping on the stroke

#

i dont know if there's an easy fix

#

incidentally, this issue only happens on the top stroke, which I assume is because the table is drawn from top to bottom, so the top stroke is drawn first, then the fill rectangle, and then the other strokes

#

cc @brazen gorge (sorry for ping)

brazen gorge
#

it's a known tablex bug

#

but either way , it's likely you wont need tablex for that table in the next typst version

#

but

#

as a workaround, you can write header-rows: 999

#

forces your entire table to be drawn at once

#

btw, theres a note in the tablex README about usage of rotate

#

i'd suggest taking a look

#

in particular to make the cell have the correct size

#

in the next typst version you can fix it with rotate(..., reflow: true), but that's not the case currently

#

so theres a workaround shared by a community member, dont have the link in hand rn but it's in the readme

vernal solar
#

How does the Typst release shedule work ? Or when is the next release expected ?

brazen gorge
#

it's usually every 2 months or so

#

the next one should be in like one or two weeks