How to conditionally apply set rules to headings?

I don’t see the point of this.
I set the format so that the headings appear like "1.1."
Later, I change it to none
But if I put it inside a conditional, headings don’t get modified.

#let glosario = true
#set heading(numbering: "1.1.")

= Example 1

== Example example 1.1

= Example 2

#if glosario {set heading(numbering: none)}

= Example 3

== Example example 4

The result is this,

when I think it should be this,

Hi @JESUS , with the curly braces, you are limiting the scope of that set rule to that block. In other words, it does not exist outside of the braces. See Scripting – Typst Documentation

Try this:

#set heading(numbering: if glosario {none} else {"1.1 "})
1 Like

a syntax-sugary alternative is

#set heading(numbering: none) if glosario

which is equivalent to the original but without extra scoping

2 Likes