Marmare314 / lemmify

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

Update util.typ #14

Closed ParadaCarleton closed 1 year ago

ParadaCarleton commented 1 year ago

I think this fixes #13. But because Typst is too new to have stuff like testing frameworks, it's a bit hard to know :sweat_smile:

It should be possible to set up a very basic GitHub workflow to test whether anything fails to compile, though. (@laurmaedje would you happen to have code on hand for this?)

Marmare314 commented 1 year ago

There are already some examples in which this probably also fails. I just didn't check them since I was in a hurry. But adding some CI would be awesome and should be "relatively" simple now that png export is supported.

This unfortunately reintroduces #9. I think that if figure.has("caption") { figure.caption.body } is the right thing to here as suggested in #13. If you want to update this PR, I'm happy to merge it later (after checking the sample files this time 😅).

ParadaCarleton commented 1 year ago

When I tried that approach, I got:

error: function `figure` does not contain field `has`
   ┌─ lemmify/src/util.typ:24:19
   │
24 │   body = if figure.has("caption") { 
   │                    ^^^

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

It should have been if fig.has("caption") { fig.caption.body }.

ParadaCarleton commented 1 year ago

It should have been if fig.has("caption") { fig.caption.body }.

Thanks!

ParadaCarleton commented 1 year ago

I accidentally opened two PRs so I'm gonna close this now :sweat_smile: