PgBiel/typst-tablex

Overlap of tablex

Kreijstal opened this issue · 4 comments

#tablex(
  auto-lines: false,
  stroke: 1pt,
  columns: (auto,auto,auto,auto),
  align:center,
  //hlinex(),
  //vlinex(), vlinex(), vlinex(),vlinex(),
  [Name], [He],[Rack],[Beschreibung],
  hlinex(),
  cellx(rowspan:2,align:center)["mt01"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[42],    
  cellx(rowspan:2,align:center)["WAT"], 
  //hlinex(),
  cellx(rowspan:2,align:center)["Löschgasflasche"], "","","","",
  cellx(rowspan:2,align:center)["mt2"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[41],
  cellx(rowspan:2,align:center)["WAT"],"test"
  
) 

Sorry for the confusing matrix, here the first row is all rowpsan 2 (the reason is for dynamic generation purposes)
I guess I have to say the default does not work, is there a way to fix it?

"","","","",

The second row is just empty content, so the rowspan becomes a bit useless. Did you mean to (), (), (), (), ? (()s are totally ignored by tablex, and could also just be omitted.)

"","","","",

The second row is just empty content, so the rowspan becomes a bit useless. Did you mean to (), (), (), (), ? (()s are totally ignored by tablex, and could also just be omitted.)

Yeah that's what I thought too, but, If I don't put them there, they will literally overlap each other.

#tablex(
  auto-lines: false,
  stroke: 1pt,
  columns: (auto,auto,auto,auto),
  align:center,
  //hlinex(),
  //vlinex(), vlinex(), vlinex(),vlinex(),
  [Name], [He],[Rack],[Beschreibung],
  hlinex(),
  cellx(rowspan:2,align:center)["mt01"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[42],    
  cellx(rowspan:2,align:center)["WAT"], 
  //hlinex(),
  cellx(rowspan:2,align:center)["Löschgasflasche"], "","","","",
  cellx(rowspan:2,align:center)["mt2"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[41],
  cellx(rowspan:2,align:center)["WAT"],"test",
  (""),"","","","",
  cellx(rowspan:2,align:center)["mt3"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[40],
  cellx(rowspan:2,align:center)["WAT"],"test",
  "","","","","",
  cellx(rowspan:2,align:center)["mt3"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[40],
  cellx(rowspan:2,align:center)["WAT"],"test",
  "","","","","",
  
) 

output:
image
Let's go ahead and remove the first rows of ""'s

#tablex(
  auto-lines: false,
  stroke: 1pt,
  columns: (auto,auto,auto,auto),
  align:center,
  //hlinex(),
  //vlinex(), vlinex(), vlinex(),vlinex(),
  [Name], [He],[Rack],[Beschreibung],
  hlinex(),
  cellx(rowspan:2,align:center)["mt01"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[42],    
  cellx(rowspan:2,align:center)["WAT"], 
  //hlinex(),
  cellx(rowspan:2,align:center)["Löschgasflasche"], 
  cellx(rowspan:2,align:center)["mt2"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[41],
  cellx(rowspan:2,align:center)["WAT"],"test",
  (""),"","","","",
  cellx(rowspan:2,align:center)["mt3"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[40],
  cellx(rowspan:2,align:center)["WAT"],"test",
  "","","","","",
  cellx(rowspan:2,align:center)["mt3"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[40],
  cellx(rowspan:2,align:center)["WAT"],"test",
  "","","","","",
  
) 

image
removing the "" will make the table not work, anyway, let's instead change them to ()'s

#tablex(
  auto-lines: false,
  stroke: 1pt,
  columns: (auto,auto,auto,auto),
  align:center,
  //hlinex(),
  //vlinex(), vlinex(), vlinex(),vlinex(),
  [Name], [He],[Rack],[Beschreibung],
  hlinex(),
  cellx(rowspan:2,align:center)["mt01"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[42],    
  cellx(rowspan:2,align:center)["WAT"], 
  //hlinex(),
  cellx(rowspan:2,align:center)["Löschgasflasche"], (),(),(),(),
  cellx(rowspan:2,align:center)["mt2"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[41],
  cellx(rowspan:2,align:center)["WAT"],"test",
  (""),"","","","",
  cellx(rowspan:2,align:center)["mt3"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[40],
  cellx(rowspan:2,align:center)["WAT"],"test",
  "","","","","",
  cellx(rowspan:2,align:center)["mt3"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[40],
  cellx(rowspan:2,align:center)["WAT"],"test",
  "","","","","",
  
) 

image

So that's the reason why I used "", you are indeed right the rowspan is "useless" but as I am trying to generate a table where singlespan are exceptions and there are different rowspans, I kinda need it. I can pm you my use case when you have time about it.
Imma go ahead and remove all empty content. ("")

#tablex(
  auto-lines: false,
  stroke: 1pt,
  columns: (auto,auto,auto,auto),
  align:center,
  //hlinex(),
  //vlinex(), vlinex(), vlinex(),vlinex(),
  [Name], [He],[Rack],[Beschreibung],
  hlinex(),
  cellx(rowspan:2,align:center)["mt01"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[42],    
  cellx(rowspan:2,align:center)["WAT"], 
  //hlinex(),
  cellx(rowspan:2,align:center)["Löschgasflasche"],
  cellx(rowspan:2,align:center)["mt2"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[41],
  cellx(rowspan:2,align:center)["WAT"],"test",
  cellx(rowspan:2,align:center)["mt3"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[40],
  cellx(rowspan:2,align:center)["WAT"],"test",
  cellx(rowspan:2,align:center)["mt3"], cellx(fill: rgb("#b9edffff"), align: left,rowspan:2)[40],
  cellx(rowspan:2,align:center)["WAT"],"test",  
) 

image
My ignorance is showing, but it looks better with the ""'s

I believe the things overlapping really shouldn't happen... it's just that usually you don't use a rowspan on entire rows, as that would just be the row itself. You could test giving the rows explicit sizes through rows, that might be more helpful for your particular use case. I'll investigate the overlapping problem in due time though, so thanks for the report. 👍

This is fixed for the next release. Thanks for reporting!

In the meantime, you can use tablex.typ from the 0.0.x branch - just download the file, place it in your project and import it.