Skip to main content

Marks

Marks are arrow tips that can be added to the end of path based elements that support the mark style key, or can be directly drawn by using the mark draw function. Marks are specified by giving their names (or shorthand) as strings and have several options to customise them. You can give an array of names to have multiple marks, and dictionaries can be used in the array for per mark styling.

let c = ((rel: (0, -1)), (rel: (2, 0), update: false)) // Coordinates to draw the line, it is not necessary to understand this for this example.

// No marks
line((), (rel: (1, 0), update: false))

// Draws a triangle mark at both ends of the line.
set-style(mark: (symbol: ">"))
line(..c)

// Overrides the end mark to be a diamond but the start is still a triangle.
set-style(mark: (end: "<>"))
line(..c)

// Draws two triangle marks at both ends but the first mark of end is still a diamond.
set-style(mark: (symbol: (">", ">")))
line(..c)

// Sets the stroke of first mark in the sequence to red but the end mark overrides it to be blue.
set-style(mark: (symbol: ((symbol: ">", stroke: red), ">"), end: (stroke: blue)))
line(..c)


symbol:

Default: none

This option sets the mark to draw when using the mark draw function, or applies styling to both mark ends of path based elements. The mark's name or shorthand can be given. Multiple marks can be drawn by passing an array of names or shorthands. When none, no marks will be drawn. A style dictionary can be given instead of a str to override styling for that particular mark, just make sure to still give the mark name using the symbol key otherwise nothing will be drawn!

start:

Default: none

This option sets the mark to draw at the start of a path based element. It will override all options of the symbol key and will not affect marks drawn using the mark draw function.

end:

Default: none

Like start but for the mark at the end of a path.

length:

Default: 0.2cm

The size of the mark in the direction it is pointing.

width:

Default: 0.15cm

The size of the mark along the normal of its direction.

inset:

Default: 0.05cm

It specifies a distance by which something inside the arrow tip is set inwards; for the stealth arrow tip it is the distance by which the back angle is moved inwards.

scale:

Default: 1

A factor that is applied to the mark's length, width and inset.

sep:

Default: 0.1cm

The distance between multiple marks along their path.

flex:

Default: true

Only applicable when marks are used on curves such as bezier and hobby. If true, the mark will point along the secant of the curve. If false, the tangent at the mark's tip will be used.

position-samples:

Default: 30

Only applicable when marks are used on curves such as bezier and hobby. The maximum number of samples to use for calculating curve positions. A higher number gives better results but may slow down compilation

pos:

Default: none

Overrides the mark's position along a path. A number will move it an absolute distance, while a ratio will be a distance relative to the length of the path. Note that this may be removed in the future in preference of a different method.

offset:

Default: none

Like pos but it advances the position of the mark instead of overriding it.

slant:

Default: 0%

How much to slant the mark relative to the axis of the arrow. 0% means no slant 100% slants at 45 degrees.

harpoon:

Default: false

When true only the top half of the mark is drawn.

flip:

Default: false

When true the mark is flipped along its axis.

reverse:

Default: false

Reverses the direction of the mark.

xy-up:

Default: (0, 0, 1)

The direction which is "up" for use when drawing 2D marks.

z-up:

Default: (0, 1, 0)

The direction which is "up" for use when drawing 3D marks.

shorten-to:

int or auto or none
Default: auto

Which mark to shorten the path to when multiple marks are given. auto will shorten to the last mark, none will shorten to the first mark (effectively disabling path shortening). An integer can be given to select the mark's index.

transform-shape:

Default: true

When false marks will not be stretched/affected by the current transformation, marks will be placed after the path is transformed.