-
I am writing a template with utility for other users and I'd like a function I currently have this: #let appendices() = {
pagebreak()
counter(heading).update(0)
counter("appendices").update(1)
set heading(
numbering: (..nums) => {
let vals = nums.pos()
let value = "ABCDEFGHIJ".at(vals.at(0) - 1)
if vals.len() == 1 {
return "APPENDIX " + value + ": "
}
else {
return value + "." + nums.pos().slice(1).map(str).join(".")
}
}
);
} Part 1) and 2) work but the Any way to have it working within the function? Or something else? I tried doing a global numbering and use a counter to check if I was in appendices but it did not work. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
I want to have this same functionality as well. I will start with your code and see if I can figure out a solution. |
Beta Was this translation helpful? Give feedback.
-
#let appendices(body) = {
pagebreak()
counter(heading).update(0)
counter("appendices").update(1)
set heading(
numbering: (..nums) => {
let vals = nums.pos()
let value = "ABCDEFGHIJ".at(vals.at(0) - 1)
if vals.len() == 1 {
return "APPENDIX " + value + ": "
}
else {
return value + "." + nums.pos().slice(1).map(str).join(".")
}
}
);
[#body]
}
#appendices[
= First
... text ...
= Second
... text ...
= Third
... text ...
] |
Beta Was this translation helpful? Give feedback.
Worry not - Typst has exactly what you need:
Using
#show: function
will wrap the whole document after…