How do you apply a style to Glossarium references, that is different to other reference types?

Hi @Ogre,

You were very close, as you already discovered that Glossarium uses the figure element. Figures can have different kinds—the built-in kinds are image, table, and raw. However, custom kinds can also be used, Glossarium uses the glossarium_entry kind.

You can check for this with el.kind == "glossarium_entry".

#show ref: it => {
	let head = heading
	let el = it.element
	if el != none and el.func() == heading {
	// Override heading references.
		text(fill: red)[#link(el.location())[#it: #el.body]]
	} else if el != none and el.func() == figure and el.kind == "glossarium_entry" {
		smallcaps(it)
	} else {
		// Other references as usual.
		it
	}
}

If you’re wondering how to figure this out, you have two options: either read the source code of Glossarium :slight_smile: or if you use the Typst web app, simply hover your mouse pointer over the it in #show ref: it => {.

1 Like