Give the same spacing to three symbols

Hey all, is there a clean or direct way to let symbols take the same space?
More concretely, I use the three symbols □, $circle$ and $diamond.medium$.
When I write an equation, the spacing of these symbols is different, which in my opinion does not look good.

For example, in the last two rows i use the exact same symbols, but in a different order. But the spacing is different for some reason.

Is there a way to give all these symbols the exact same space?

The spacing between symbols depends on their classes. You can check the default classes in General Symbols - Typst Documentation.
In your case, square and diamond.medium are normal, but circle is binary. Therefore, the spacing between them varies.
Refer to Can I fix the ugly spacing with `union/inter.big`? - #2 by Y.D.X for the details.

To make the spacing consistent, you can #let circle = $class("normal", circle)$ to override the default class.

= Before
$
  prec.eq square circle diamond.medium prec.eq \
  prec.eq circle diamond.medium square prec.eq \
  prec.eq diamond.medium square circle prec.eq
$

= After
#let circle = $class("normal", circle)$
$
  prec.eq square circle diamond.medium prec.eq \
  prec.eq circle diamond.medium square prec.eq \
  prec.eq diamond.medium square circle prec.eq
$

1 Like

Thank you. Is there a way to make this a bit more evenly spaced? In your picture the space between the symbols varies a lot.

I guess that’s because the widths of these symbols are inconsistent, and the shapes introduce additional visual illusion.

Perhaps you can try something like let square = h(0.1em) + sym.square + h(0.1em) or let square = box(width: 1em, inset: (x: 0.1em), sym.square)?