-
I would like to make sure that all my section references in a typst document are underlined. I tried to create a show rule to do it but unable to make it work. It would look like this . The goal is to make the @section look like what I did above with the = Problématiques du stage <section>
#underline(
stroke: 1.5pt blue_edf,
offset: 3pt,
ref(supplement: "Section", <section>)
)
@section |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, you can do #show ref: it => {
let el = it.element
if el != none and el.func() == heading and el.level == 1 {
underline(stroke: 1.5pt blue, offset: 3pt, it)
} else { it }
} We create a Now you can just reference your sections via |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Hi, you can do
We create a
show
rule forref
that filters for theelement
field of the reference. Thiselement
may benone
(for citations for example). Then we check that the element is indeed a heading and that the level is1
. Alternatively, the last condition could beel.supplement == [Section]
, however, this does not work across different languages.Now you can just reference your sections via
@section
and they will automatically have the desired style.