ThatOneCalculator / riesketcher

Riemann sum graphs in Typst with CeTZ
MIT License
14 stars 0 forks source link

Example throws : error: dictionary does not contain key "bounds" #7

Closed yuesubi closed 3 months ago

yuesubi commented 3 months ago

Hi, I saw your package and I wanted to use it to illustrate Riemann sums, but I can't get it to work :sob:.

I tried the following example you provide (and others)

#import "@preview/riesketcher:0.2.0": riesketcher

It doesn't work T-T

#riesketcher(
  x => calc.pow(x, 3) + 4,
  method: "left",
  start: -3.1,
  end: 3.5,
  n: 10,
  plot-x-tick-step: 1,
)

and here's what I get : asad

I'm on typst 0.11.1, on Linux Mint 21.1.

Let me know if I can provide additional info ! :smile:

yuesubi commented 3 months ago

My bad, I didn't know you needed to wrap up the hole thing in a canvas ^^'

yuesubi commented 3 months ago

But I still can't compile the examples, and I wonder if I really encountered a bug this time.

Trying to compile the example

#import "@preview/riesketcher:0.2.0": riesketcher
#import "@preview/cetz:0.2.2" : canvas, plot

#canvas({
  riesketcher(
    x => 16 - x * x,
    method: "right",
    end: 6,
    n: 6,
    domain: (-1, auto),
    plot-x-tick-step: 1,
)})

Throws the error

error: dictionary does not contain key "bounds"
   ┌─ @preview/cetz:0.2.2/src/process.typ:18:18
   │
18 │       if drawable.bounds {
   │                   ^^^^^^

help: error occurred in this call of function `element`
   ┌─ @preview/cetz:0.2.2/src/process.typ:63:12
   │
63 │     let r = element(ctx, el)
   │             ^^^^^^^^^^^^^^^^

help: error occurred in this call of function `many`
   ┌─ @preview/cetz:0.2.2/src/canvas.typ:64:33
   │
64 │   let (ctx, bounds, drawables) = process.many(ctx, body)
   │                                  ^^^^^^^^^^^^^^^^^^^^^^^
ThatOneCalculator commented 3 months ago

This was already fixed in v0.2.1

yuesubi commented 3 months ago

My bad, I'll pay more attention next time