cancel
ElementElement functions can be customized with set
and show
rules.
set
and show
rules.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) $

ParametersParameters are the inputs to a function. They are specified in parentheses after the function name.
body
The content over which the line should be placed.
length
SettableSettable parameters can be customized for all following uses of the function with a set
rule.
set
rule.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%) $

inverted
SettableSettable parameters can be customized for all following uses of the function with a set
rule.
set
rule.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) $

cross
SettableSettable parameters can be customized for all following uses of the function with a set
rule.
set
rule.If two opposing cancel lines should be drawn, forming a cross over the
element. Overrides inverted
.
Default: false
$ cancel(Pi, cross: #true) $

rotation
SettableSettable parameters can be customized for all following uses of the function with a set
rule.
set
rule.Rotate the cancel line by a certain angle. See the line's documentation for more details.
Default: 0deg
$ cancel(Pi, rotation: #30deg) $

stroke
SettableSettable parameters can be customized for all following uses of the function with a set
rule.
set
rule.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",
),
) $
