How to customize the style of equation numbering?

For figure.caption you’ve missed the it.separator which is equal to : by default.

#let JF_FS_SMALL = 14pt
#set page(paper: "a6")
#let your-default-font = "Linux Libertine"
#set text(font: your-default-font)

#show figure.caption: it => context text(
  size: JF_FS_SMALL,
  [*#it.supplement #it.counter.display(it.numbering)#it.separator* #it.body],
)

// #set math.equation(numbering: "(1)") // not bold
#set math.equation(numbering: (..n) => {
  strong(text(font: your-default-font, numbering("(1)", ..n)))
})

#figure(caption: [caption], rect())
$ y = 2x $

image

The problem with equation is that it uses the default math font (which I didn’t really think/know about before), therefore strong() has no effect on it. To fix this, you have to use some other typeface that has a bold font.

Note that using a custom numbering function has a side effect that is described here: How to increase the spacing between the number and the title of a heading? - #2 by Andrew.


Typst 0.12 update

With Typst v0.12.0 you can use the built-in bold math font like this:

#set math.equation(numbering: (..n) => strong(numbering("(1)", ..n)))
$ y = 2x $

This means that the your-default-font stuff can be removed.

1 Like