You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't use function for headingnumbering if level is greater than 1 #2101
I've checked the documentation and I don't see any warnings that this wouldn't work. Either add a note about this, or this is a bug.
I was using it like this: #heading(numbering: it => none)[] and wanted to pass a level, but suddenly got an error. Then I've checked, and I can actually pass none directly and therefore don't need to decrease heading counter. But this removes the nested indent in outline (with it => none the indent is present, but the number is missing, which is what I want).
auto: Indents the numbering of the nested entry with the title of its parent entry. This only has an effect if the entries are numbered (e.g., via heading numbering).
Ok, I've found everything that I wanted, including that I used true instead of auto. But now the question is what is auto exactly? The documentation doesn't say that.
But I've found a solution to my problem:
#setoutline(indent: it=>for_inrange(it) { h(1em) }) // I'm guessing `auto` is an alias for `1em`#letunnumbered-heading(name, ..args) = {
heading(numbering: none, name, ..args)
}
Update:
Actually, outline can be just #set outline(indent: 1em). I've tried bigger nesting level directly after 1st level, which doesn't work either way. You have to have at least 1 entry of every single level from 1 to n (no skips).
Like, what does it say? How it is unexpected, when with level: 1 everything works? The function has to get some arguments, right? So maybe change the error to be more user-friendly? I also probably should open a separate issue.
Activity
freundTech commentedon Sep 10, 2023
This is a bit of a quirk due to the fact that numberings use varargs arguments.
Look at the
numberingfunction:numbering("1.", 3) // 3. numbering("1.", 3, 7) // 3.7.Your custom numbering function must also accept a variable amount of arguments. This is done like this:
If the level is fixed like in your example you can also accept a fixed number of arguments like this:
Andrew15-5 commentedon Sep 10, 2023
https://typst.app/docs/reference/meta/outline/:
Ok, I've found everything that I wanted, including that I used
trueinstead ofauto. But now the question is what isautoexactly? The documentation doesn't say that.But I've found a solution to my problem:
Update:
Actually,
outlinecan be just#set outline(indent: 1em). I've tried bigger nesting level directly after 1st level, which doesn't work either way. You have to have at least 1 entry of every single level from 1 to n (no skips).Andrew15-5 commentedon Sep 10, 2023
@freundTech, I guess it is kinda understanding, if I dig deep:
https://typst.app/docs/reference/meta/heading/#parameters-numbering:
https://typst.app/docs/reference/meta/numbering/:
But the problem is more to do with the error:
Like, what does it say? How
itis unexpected, when withlevel: 1everything works? The function has to get some arguments, right? So maybe change the error to be more user-friendly? I also probably should open a separate issue.Enivex commentedon Sep 10, 2023
It's unexpected because the way it's written you can receive only a single argument.
laurmaedje commentedon Sep 10, 2023
The diagnostic is bad, you can open a separate issue about that.