How to rename a specific figure kind's supplement?

For example,

#figure(
```tsx
Example code
```,
caption: "Example"
)

Has a supplement of Listing (Listing 1: Example). How can the label of a type of figure be changed globally, and only to that specific type? For example, to be Code (Code 1: Example) if changing the listing figure type.

Figures that have a raw element (a code block) as their body automatically have their kind set to to raw as well. You can thus use a show-set rule to set the supplement for all figures of this kind:

#show figure.where(kind: raw): set figure(supplement: [Code])
3 Likes

Hey @benjavicente, I’ve updated your post title to better fit our guidelines: How to post in the Questions category

Please ensure your title is a Typst question you’d ask to a friend. :slight_smile:

Wow, that’s unexpectedly elegant. Thanks!