typst / typst

A new markup-based typesetting system that is powerful and easy to learn.
https://typst.app
Apache License 2.0
29.17k stars 793 forks source link

Show-set rules don't seem to work for `table.cell` #4159

Open MatejKafka opened 2 weeks ago

MatejKafka commented 2 weeks ago

Description

The following code results in the strong text being red (as expected), but the table cell fill remains unset. I'm aware I could just use a set rule for this, but in the actual code I'm also using a selector, which currently does not work with set rules.

#{
  show table.cell: set table.cell(fill: red)
  table("1", "2", "3")

  show strong: set text(fill: red)
  strong("test")
}

image

Reproduction URL

No response

Operating system

Web app

Typst version

PgBiel commented 2 weeks ago

Unfortunately this just hasn't been implemented yet, but it will be in the future, for sure.

In the meantime, if your selector only relies on the cell's position, you can use e.g. #set table(fill: (x, y) => if x == 0 { red } else { blue }).