Marmare314 / lemmify

A library for typesetting mathematical theorems in typst.
GNU General Public License v3.0
11 stars 7 forks source link

Regression in 0.1.3 with figure caption #13

Closed laurmaedje closed 9 months ago

laurmaedje commented 9 months ago

This code

#import "@preview/lemmify:0.1.3" : *
#let (theorem, rules) = default-theorems("thm-group")
#show: rules
#theorem[Theorem content goes here.]

gives the error

error: cannot access fields on type none
   ┌─ @preview/lemmify:0.1.3/src/util.typ:25:16
   │
25 │     fig.caption.body,
   │                 ^^^^

help: error occurred while applying show rule to this figure
   ┌─ @preview/lemmify:0.1.3/src/util.typ:7:4
   │  
 7 │ ╭     figure(
 8 │ │       content,
 9 │ │       caption: name,
10 │ │       kind: group,
11 │ │       supplement: subgroup,
12 │ │       numbering: numbering
13 │ │     )
   │ ╰─────^

Which is probably wrong unless I'm missing something. Perhaps if should be if figure.has("caption") { figure.caption.body }?

(This reached me via web app feedback.)

Marmare314 commented 9 months ago

Thanks for forwarding this!