I have this:
$
min -2 & x_1 -3 & x_2 \
"u.d.N." & x_1 + 2 & x_2 <= 8 \
2 & x_1 + & x_2 <= 9 \
& & -x_1 <= 0 \
& & -x_2 <= 0 \
& & x in ZZ^2
$
I would expect this to align all the x_1s and x_2s, but the first one isnโt being aligned correctly
Y.D.X
October 21, 2025, 9:47am
2
Will this satisfy you?
$
min -2 x_1 & - & 3 x_2 & #hide($=$) \
"u.d.N." quad x_1 & + & 2 x_2 & <= 8 \
2 x_1 & + & x_2 & <= 9 \
& - & x_1 & <= 0 \
& - & x_2 & <= 0 \
& & x & in ZZ^2
$
Or maybe this?
$
min -2 x_1 && - 3 x_2 & #hide($=$) \
"u.d.N." quad x_1 && + 2 x_2 & <= 8 \
2 x_1 && + x_2 & <= 9 \
&& - x_1 & <= 0 \
&& - x_2 & <= 0 \
&& x & in ZZ^2
$
Explanation
Quoting Math โ Typst Documentation
When equations include multiple alignment points (&), this creates blocks of alternatingly right- and left-aligned columns. โฆ Each alignment point (&) simply alternates between right-aligned/left-aligned.
In addition, I have to use the hide function to fix a small deviation, which might be a typst bug?
Without hide:
1 Like
Andrew
October 21, 2025, 6:18pm
3
IMO, this is better:
#let hide = hide
#let blq = $hide(=)$ // blank equal
$
& min & -2 x_1 & - & 3 x_2 & blq \
& "u.d.N." & x_1 & + & 2 x_2 & <= 8 \
& & 2 x_1 & + & x_2 & <= 9 \
& & & - & x_1 & <= 0 \
& & & - & x_2 & <= 0 \
& & & & x & in ZZ^2
$
The only thing I wonder if the hidden content is also excluded for AT.