Cross-references to chapters and sections
Thank you for your contribution to the typst community. While using this template, I discovered that #chapter cannot be @ referenced. Other heading are referenced with the number appearing on the left side of the page. Is it possible to fix them?
Hi, fixed chapter referencing (see example.typ chap1). The other are more difficult, I will fix in the future.
~~hi, unfortunately when referencing to a subsection (prexixed with == or ===) or #heading via <label> the styles and linebreaks are transferred as well so the style is not entirely overridden when referencing to subchapters/sections. so line breaks are happening after the chapter prefix~~
removed, because actually identical with above question
you could use something like this:
#show ref: it => {
let eq = heading
let el = it.element
// let numberingFormat = if appendix-state != none {"A.1"} else {"1.1"} //appendix state must be sourced somehow
let numberingFormat = {"1.1"}
if el != none and el.func() == eq {
let arrayEq = counter(eq).at(el.location())
[#el.supplement #numbering(numberingFormat, ..arrayEq) ]
} else {
it
}
}
Fixed with version 0.2.0