Hi all,
I’m new to Typst—it’s a great typesetting language!
I’ve been using it to write my resume and learning along the way. I’m using the minimal-cv template, which is excellent, but it produces a warning about “content labelled multiple times.” I tried to fix it myself, and during this journey, I thought I had found a bug in Typst (#7692), but it turns out this is intended behavior.
Anyway, the template triggers the warning because it uses an “ellipse hack” to pass the theme parameter into functions. Specifically, it:
- Marks function bodies with
label()in functions likesection(), with the optional theme stored inellipse.insetorellipse.outsetattributes - Uses
show label("cv-label")rules to process the content and extract the theme from theellipseattributes
Contributors advised me to use state() instead of this approach. So I dove into learning state() and quickly ran into a question: It seems state() doesn’t follow scoping rules. What I mean is, I cannot temporarily set a state value within a block scope and have it automatically restore to its previous value after exiting the scope—the way set ellipse.inset works with style properties.
Is there any way to achieve scoped state behavior, or is this on Typst’s roadmap? Is there an existing issue tracking this feature?
Thanks for any guidance!