#let a = $accent(italic(M), arrow)$.body.base
#let b = $cal(M)$.body
#(a == b) // → true
#(math.equation(a) == math.equation(b)) // → true
#math.equation(a) #math.equation(b) // → two different-looking M
I think its a reasonable assumption to make that if you have two things that compare equal that they also render equal (unless we change the context between them)
In this specific case, a and b are styled() elements, and it appears as though == does not consider the style. I would consider this a bug with Typst if I’m honest.
This can also be reproduced without any math mode (so its not math-mode-specific weirdness):
#let a = [#set text(font: "Clicker Script");M]
#let b = [#set text(weight: 800);M]
#(a == b) // → true
#a #b // → two different-looking M
In my opinion, it should not be possible to define a and b such that the following code
+ `#a` is #a.
+ `#(a == b)` is #(a == b).
+ But `#b` is #b.
#let a = [#set text(size: 1em);normal]
#let b = [#show "normal": it => "not normal and contains a hidden message";normal]
In either case, as a workaround you can use a.child/b.child (i.e. a.body.base.child/b.body.child in the original example) to gain access to the raw, unstyled M
Thank you!
However, I would like to distinguish between two different styles. Is there any way to access the style programmatically ?
To be clear, I am looking for a function that would return false for a and b and true for a and a.
I also thought about comparing directly the source code of the equations but I believe there is no way to retrieve the source code of a content in code mode.