Why do contents after `&` affect alignment?

Hi.

$
  #[hello]&= \
  #[world]& \
$

$
  #[hello]&= \
  #[world]&= \
$

image

Why is the first world slightly shifted to the right?

1 Like

Hello. Maybe the same reason it happens with this:

$
  a &) \
  a &=
$

image

$
  "hello" & = \
  "world" &
$

$
  "hello" & = \
  "world" & =
$

It aligns it with the equal sign.
image

1 Like

Thanks for answering!

In my initial mental model, & should be a separator, instead of attached to a character. In what layer is Typst’s alignment system? Is it builtin the rust engine or can I replace it with some custom package function?

Math alignment

If no explicit packages are used in a document, then it’s baked into the compiler written in Rust. You can change its behavior by patching the source code.

1 Like