lib module

cetz-label function

#let cetz-label(
  body,
  node: none,
  offset: (x: 16mm, y: -10mm),
  via: (),
  controls: (),
  anchor: auto,
  padding: 2pt,
  fill: white,
  label-stroke: none,
  arrow-stroke: 0.7pt + black,
  arrow-fill: black,
  mark: "stealth",
  mark-scale: 0.7,
  target-gap: 0pt,
)

Documentation

Construct a CeTZ leader label. offset and every via entry are relative to the projected node in Typst screen coordinates: positive x moves right and positive y moves down. Side leaders leave the text at its typographic vertical center. Leaders are straight or follow via line segments unless the caller explicitly supplies one or two CeTZ Bezier controls. The optional white label fill prevents dense morphology geometry from showing through the text without drawing a frame.

Parameters

  • body (content): Label content.
  • node (int): Node ID targeted by the leader. Default: none.
  • offset (dictionary): Typst x and y lengths from the node to the label. Default: (x: 16mm, y: -10mm).
  • via (array): Optional relative polyline vertices as x and y length dictionaries. Default: ().
  • controls (array): Zero, one, or two relative CeTZ Bezier control points. Default: ().
  • anchor (auto, str): Automatic or explicit CeTZ anchor for the label content. Default: auto.
  • padding (length): Non-negative padding around the label content. Default: 2pt.
  • fill (any): Label background fill accepted by CeTZ. Default: white.
  • label-stroke (any): Optional label frame stroke accepted by CeTZ. Default: none.
  • arrow-stroke (any): Leader stroke accepted by CeTZ. Default: 0.7pt + black.
  • arrow-fill (any): Arrowhead fill accepted by CeTZ. Default: black.
  • mark (none, str): CeTZ end-mark name, or none for no arrowhead. Default: "stealth".
  • mark-scale (int, float): Positive CeTZ end-mark scale. Default: 0.7.
  • target-gap (length): Non-negative gap between the leader endpoint and target node. Default: 0pt.

Returns

dictionary

Defined in lib.typ:450.

Source

Module
lib
Defined in
lib.typ:450
Source
View source