#Automatically inserting alignment points
9 messages · Page 1 of 1 (latest)
Is there a way to get this result without manually adding the alignment points every time?
I tried inserting the alignment points automatically, but nothings seemed to work great. I couldn't figure out how to "split" on the
= signs. The closest I could get was to slice at fixed indices, but that didn't work either because some whitespace node throw off the math.
#let insert_alignments(eqn) = {
for line in array(eqn.body.children).split(linebreak()) {
let a = line.slice(0,1).join()
let b = line.slice(2).join()
$ &#a && #b $
}
}
#insert_alignments($
X = a W + a Z \
W = b X \
Z = 1
$)
can't say I'd recommend it, but you can do something like this.
?r
#show math.equation.where(block: true): it => {
show "=": $&=$
it
}
$
a = b + 30 \
c + d = e + 40
$
Clever! Is there a way to also add a "&" at the start of every line?