Is there an equivalent to Latex's \cancelto in Typst?

I’m not aware of an easy solution for this, you might as well create a new issue for this.

Here is my very rough solution:

#let cancelto(body, to) = {
  let arrow = rotate(-55deg, scale(x: 170%, $-->$))
  context {
    let m = measure(body)
    let (w, h) = (m.width, m.height * 2)
    set place(center + horizon)
    // block(height: h * 2.5, align(horizon, body)) // Add vertical margins.
    body
    place(dx: -w * 0.5, dy: -h * 0.1, arrow)
    place(dx: w * 0.3, dy: -h * 1.1, $0$)
  }
}

$(diff T)/(diff t) = k (diff^2 T)/(diff z^2) + v_z (diff T)/(diff z)$

$cancelto((diff T)/(diff t), 0) = k (diff^2 T)/(diff z^2) + v_z (diff T)/(diff z)$

$(diff T)/(diff t) = k (diff^2 T)/(diff z^2) + v_z (diff T)/(diff z)$

image

image

4 Likes