Closed xy9485 closed 11 months ago
You are correct, algo
returns "plain content", so you cannot directly attach a label. You can get around this by manually wrapping it in a figure:
#let my-algo(...) = {
#figure(algo(...), kind: "algorithm")
}
#my-algo(...)[...] <algo1>
In the future, I will do a complete rewrite of the package, and one of the changes I'll make is have algo
output a figure to bring it in line with similar packages. Currently, I'm waiting for some critical features to land in Typst so I can implement all my planned improvements at once.
I find it's a pleasing experience to write pseudo code with this package. However, I find myself stuck with how to reference an algorithm using "@".I tried below to label my algorithm but it doesn't work with error:
cannot reference sequence
. I label my algorithm with@algo1[Algorithm]
as below:I'm a beginner of typst, this is what I learned to achieve reference. I'm not sure if it also works with returns of #algo. Otherwise is there any other workaround to refer an algorithm as we do in Latex? I just need at least a basic way to refer my own algorithms.