Documentation

cancelElement
Question mark

Displays a diagonal line over a part of an equation.

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

Example

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

Parameters
Question mark

body
content
Required Positional
Question mark

The content over which the line should be placed.

length
relative
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.

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

Default: 100% + 3pt

inverted
bool
Settable
Question mark

Whether the cancel line should be inverted (flipped along the y-axis). For the default angle setting, inverted means the cancel line points to the top left instead of top right.

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

Default: false

cross
bool
Settable
Question mark

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

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

Default: false

angle
auto or angle or function
Settable
Question mark

How much to rotate the cancel line.

View example
$ cancel(Pi)
  cancel(Pi, angle: #0deg)
  cancel(Pi, angle: #45deg)
  cancel(Pi, angle: #90deg)
  cancel(1/(1+x), angle: #(a => a + 45deg))
  cancel(1/(1+x), angle: #(a => a + 90deg)) $
Preview

Default: auto

stroke
length or color or gradient or stroke or tiling or dictionary
Settable
Question mark

How to stroke the cancel line.

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

Default: 0.5pt