I am writing code in math blocks. Parentheses make lines higher. How to fix this? Here is my typst code
#block(inset: (left: 2em), align(left, [$
& "cost" :: "Tree Int" -> "Int" \
& #block[$
& "cost" ("Leaf" x) & & = x \
& "cost" ("Node" u" "v) & & = 1 + max" "("cost" u)" "("cost" v) \
$]
$]))
Here is the result
gezepi
2
This doesn’t address the why, but it does answer the question
How to fix this?
Adding an invisible ( to the first line also forces that line to have the same height as the others.
#block(inset: (left: 2em), align(left, [$
& "cost" :: "Tree Int" -> "Int" #hide($($)\
& #block[$
& "cost" \("Leaf" x\) & & = x \
& "cost" \("Node" u" "v\) & & = 1 + max" "\("cost" u\)" "\("cost" v\) \
$]
$]))
2 Likes