andreasKroepelin / lovelace

A Typst package for typesetting pseudocode
MIT License
43 stars 3 forks source link

Small fix for repeated supplement in algorithm header. #1

Closed sultur closed 12 months ago

sultur commented 12 months ago

Hello! I hope you don't mind the pull request :).

Bug description

I fixed a small bug where "Algorithm #" (the figure supplement and counter) got repeated in the algorithm header when the algorithm environment included a caption. E.g. instead of saying

Algorithm 1: Spurwechsel nach links auf der Autobahn

it said

Algorithm 1: Algorithm 1: Spurwechsel nach links auf der Autobahn

See the following image for the bug and a small reproducible example (version 0.1.0): image

Changes

Now only it.caption.body is shown if the algorithm figure has a caption (as lovelace already displays the supplement and counter). When it doesn't have a caption, the title ends with . instead of : (just a minor stylistic choice, feel free to change it if you prefer something else).

I also losslessly compressed the example PNG files using the great tool oxipng. Not necessary, but saves a little bit of space :).

Thank you for a fantastic package :)!

andreasKroepelin commented 12 months ago

This is actually due to a change in figure caption handling in the recent Typst version. Thanks for the fix, glad you like the package :)

sultur commented 12 months ago

Ah exactly, I suspected that, thank you for merging the PR :)