Hi everyone. Recently I ran into two problems with typst, and I found that typst documentation lacks clear explanations, so I’m sharing them here.
- In function, the documentation format of the function is not explained (nor is it explained in the ‘comments’). It wasn’t until I wrote a plugin that VS code’s autocomplete prompted me to comment with three slashes like this:
/// ...
///
/// - arg (...): ...
/// -> ...
#let func(arg) = {}
- In functions, unpacking is not explicitly stated. When I write an oral arithmetic practice document, I need to pass the value of array into the table. typst’s documentation also doesn’t give a clear explanation until AI helps me this time:
#table(
columns: (1fr, 1fr),
.. range(50).map(i=>{
str(a.at(i)) " " str(b.at(i)) " ="
})
)
I’ve never seen a two-point explanation in the documentation for unpacking, so I’ve made a lot of stupid attempts, including trying to define a list and then adding elements to it (there is no such method), or using a for-loop directly in the definition of a table (and then giving an error).