How to fix "Warning: state.display is deprecated in 0.12.0"?

Hi,
I’m migrating my templates to Typst 0.12.0 and i’m stucked on this state display. By replacing it with get I’m not able to make it work. Any idea?

number = thmcounters.display(x => {
  return global_numbering(numbering, ..x.at("latest"))
})

I tried this but I get wrong value of the state variable.

number = global_numbering(numbering, ..thmcounters.get().at("latest"))

Thanks a lot

See here: Update ctheorems for Typst 0.12 by PgBiel · Pull Request #39 · sahasatvik/typst-theorems · GitHub.

@PgBiel is already working on updating ctheorems, so you can copy his fixes.

1 Like

Thanks a lot, the trick was suing context right after the “=”.

number = context {
  global_numbering(numbering, ..thmcounters.get().at("latest"))
}

Hey @Flavio , please post questions in Questions in the future! I’ve also updated your title to be compliant with our question post guidelines: How to post in the Questions category (generally, make sure your post title is a question you’d ask to a friend about Typst :wink:)

Thanks and hope you enjoy using the forum! :typstguy: