Monospaced math content created with $mono(...)$
actually just uses the default math font, which contains its own monospaced characters. As it seems like you want to use a normal text font, which is not intended to be used for math content, it would probably make more sense to use raw
blocks to create monospaced text. As the backtick syntax doesn’t work in math mode, you need to either call #raw
explicitly, or temporarily switch to code mode with a #
:
$ x + #raw("y") = #`code` $
With this, you can then easily change the font via a show-set rule, though you may need to adjust the text size so it matches the surrounding text.
#show raw: set text(font: "JetBrainsMono NF")
If this font should only be used for math, you can also either scope the show-set rule in a show rule for equations, or create a custom mono
function. Keep in mind then that raw
only accepts strings as arguments, so you always need to wrap your monospaced text in quotation marks.