TypstDocumentation

cancelElement
Question mark

Displays a diagonal line over a part of an equation.

This is commonly used to show the eliminiation of a term.

Example

Here, we can simplify:
$ (a dot b dot cancel(x)) /
    cancel(x) $
Preview

Parameters
Question mark

body
content
RequiredPositional
Question mark

The content over which the line should be placed.

length
relative length
Settable
Question mark

The length of the line, relative to the length of the diagonal spanning the whole element being "cancelled". A value of 100% would then have the line span precisely the element's diagonal.

Default: 100% + 3pt

$ a + cancel(x, length: #200%)
    - cancel(x, length: #200%) $
Preview

inverted
boolean
Settable
Question mark

If the cancel line should be inverted (pointing to the top left instead of top right).

Default: false

$ (a cancel((b + c), inverted: #true)) /
    cancel(b + c, inverted: #true) $
Preview

cross
boolean
Settable
Question mark

If two opposing cancel lines should be drawn, forming a cross over the element. Overrides inverted.

Default: false

$ cancel(Pi, cross: #true) $
Preview

rotation
angle
Settable
Question mark

Rotate the cancel line by a certain angle. See the line's documentation for more details.

Default: 0deg

$ cancel(Pi, rotation: #30deg) $
Preview

stroke
length or color or dictionary or stroke
Settable
Question mark

How to stroke the cancel line. See the line's documentation for more details.

Default: 0.5pt

$ cancel(
  sum x,
  stroke: #(
    paint: red,
    thickness: 1.5pt,
    dash: "dashed",
  ),
) $
Preview