PgBiel / typst-tablex

More powerful and customizable tables in Typst
MIT License
370 stars 12 forks source link

unknown variable: grid-index-at #62

Closed GermanHeim closed 12 months ago

GermanHeim commented 12 months ago

Using Typst 0.8.0 (Web), the following error is produced: unknown variable: grid-index-at - if you meant to use subtraction, try adding spaces around the minus sign.(failed in package "@preview/tablex:0.0.5")

Reproduction example:


 tablex(
  columns: (auto, auto),
  rows: auto,
  align: center + horizon,
  auto-vlines: false,
  header-rows: 1,
  fill: (_, row) => if calc.odd(row) { rgb(37, 150, 250, 30)} else { white },

  /* --- header --- */
  rowspanx(1)[*Volumen de NaOH utilizado (±0,05)$upright(m L)^((a))$*],(), rowspanx(1)[*Concentración de NaOH (±0,0018)$upright(M)^((b))$*], (),
  /* -------------- */
  [10,30], [0,0971],
  [10,30], [0,0971],
  [10,35], [0,0966],
  [10,40], [0,0961],
  [10,40], [0,0961],
  [10,40], [0,0961],
  [10,60], [0,0943],
  [10,90], [0,0917],
), 
PgBiel commented 12 months ago

Faulty line: https://github.com/PgBiel/typst-tablex/blob/daace3623fc60c6a15cf0ecc4a9098c51f350163/tablex.typ#L2273

Replacing by

index = grid-index-at(cell.x, cell.y, grid: grid)
grid.items.at(index) = cell 

works. Seems to be an upstream Typst bug introduced somewhere in 0.8.0.

PgBiel commented 12 months ago

Fixed with https://github.com/typst/typst/commit/25613cfaf3a20f737ac347f7d7144a5dcaa709a5 (pushed to the web app just now).