#How do I reset the heading counter?
29 messages · Page 1 of 1 (latest)
?render
#set heading(numbering: "1.1")
= Intro
= Other One
#set heading(numbering: "A.1")
#counter(heading).update(1)
= Topic name Appendix A
== Subtopic name Appendix A.1
= Topic name Appendix B
Ok found a solution:
?render
#set heading(numbering: "1.1")
= Intro
= Other One
#set heading(numbering: (..args) => {
let nums = args.pos()
if nums.len() == 0 { return [] }
nums.first() = nums.first() - 1
numbering("A.1", ..nums)
})
#counter(heading).update(1)
= Topic name Appendix A
== Subtopic name Appendix A.1
= Topic name Appendix B
that’s terrifying
@warm moat Is this intended?
(no)
Probably not but I can see why it currently works this way
I can’t?
Consider this, without the updating of the heading
?render
#set heading(numbering: "1.1")
= Intro
= Other One
#set heading(numbering: "A.1")
= Topic name Appendix A
== Subtopic name Appendix A.1
= Topic name Appendix B
it goes 1 2 3 4, right
makes sense (though I personally think that whenever you update the heading numbering it should default to resetting the counter, but whatever)
You set the value to 1 via update and the next heading uses step on it. This is how you get a 2
so there’s no way to reset the heading to the first element
that’s definitely unintended behavior
Yep
?render
#set heading(numbering: "1.1")
= Intro
= Other One
#set heading(numbering: "A.1")
#counter(heading).update(())
= Topic name Appendix A
== Subtopic name Appendix A.1
= Topic name Appendix B
No I dont like this
wdym, isn't that what you wanted to achieve?
Oh sorry I completely missed the example