Can I define $⊂=$ to show as $subset.eq$?

I am wondering if defining own shortcuts by linking operators (analogously to how <= is lt.eq) is possible, and if so how. Clearly I can’t simply write

let ⊂= = subset.eq

Cheers!

Hello!
To define a shortcut for ⊆, you can simply define a variable

#let sse = math.subset.eq
$
  sse
  subset.eq
$

As you said, writing a variable can only be defined within specific naming constraints. See

2 Likes

Thanks for your reply! I’m aware of how to define variables, I was just wondering if defining a composition of operators similarly to <= but ⊂= would be possible in some way. Thanks for the link to the naming constraints, that’s useful. But perhaps there is another way to do this?

hmmm, I don’t think it’s possible in Typst, but you can open an issue at the Typst repo to add new shorthands!

1 Like

You can use the quick-maths package which traverses the equation content and replaces any direct occurrences of given shorthands with their respective symbols. This method is relatively naive, so it may break when defining more complex shorthands.

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

#show: shorthands.with(
  ($⊂=$, $subset.eq$)
)

$ A ⊂= B $

(Note: I am the author of that package)

3 Likes

This is great :-) thanks for the info and your work on the package