For example, here is a code that references a title:
#set heading(numbering: "1.")
== Colours <sub:colours>
@sub:colours is a title
Instead of referencing as Section 0.1 is a title
can I get something like - Colours is a title
?
For example, here is a code that references a title:
#set heading(numbering: "1.")
== Colours <sub:colours>
@sub:colours is a title
Instead of referencing as Section 0.1 is a title
can I get something like - Colours is a title
?
Hello!
I have changed your question to “How to get the entire title when referencing headings?”, if that’s wrong, please correct it!
The syntax @label
is called a reference. See ref
for more details, and in particular, you can read the section on Customization.
Inspecting the content of it
inside the conditional statement, gives you
ref(
target: <sub:colours>,
supplement: auto,
form: "normal",
citation: cite(key: <sub:colours>, supplement: none),
element: heading(
level: 2,
depth: 2,
offset: 0,
numbering: "1.",
supplement: [Section],
outlined: true,
bookmarked: auto,
hanging-indent: auto,
body: [Colours],
),
)
where you can see that the heading
is in fact the element
of ref
(it
). Accessing the title of the heading is as simple as writing it.element.body
.
#set heading(numbering: "1.")
#show ref: it => {
let el = it.element
if el != none and el.func() == heading {
link(el.location(), el.body)
}
}
== Colours <sub:colours>
@sub:colours is a title