How can I [a]new definition a math symbol

I can use #let cong = math.class("normal", "≌") to new definition a math symbol, but how can I [a]new definition a math symbol like gt.eq(a symbol with point). Use #let gt.eq = math.class("normal", $gt.eq.slant$) is wrong.

The symbol with a point is a symbol and you can make new ones and your own ones.

Like this, excuse the silly name, it’s all for demonstration

#let mygt = symbol(">", ("eq", sym.gt.eq.slant))
$mygt mygt.eq$

image

So if you’re happy with that - you can make your own “collection” of symbols grouped like this - then that’s great.

But if we want to change just one of the symbols under gt, how do we do that? We would like to create a modified copy of the built-in sym.gt. Unfortunately I don’t see a way to access the array of variants of the gt symbol, inside typst, so I don’t see an easy way of doing it, short of listing them all again.

An alternative solution, if you never want to see the original gt.eq symbol, is to replace it with a show rule:

#show sym.gt.eq: sym.gt.eq.slant
$a >= b$. This is #sym.gt.eq that.

image

Hello. You don’t explain how you are using that. For overriding math symbols there is quick-maths – Typst Universe.

#import "@preview/quick-maths:0.2.1": shorthands

#show: shorthands.with(
  // (sym.gt.eq, sym.gt.eq.slant),
  ($>=$, math.gt.eq.slant),
)

$ x >= y $
$ tilde.rev.equiv $

image

Note that for already existing shorthands or symbols (such as >=), the use of that package is equivalent to the show rule

#show math.equation: it => {
  show math.gt.eq: math.gt.eq.slant
  it
}

except that your version will also replace symbols in text as in x <= y "some text with ≥" while quick-maths won’t… (And which is best depends on the use case I guess)

1 Like

Great. Thanks to your answer,

1 Like