#CeTZ centre multiple marks on line

6 messages · Page 1 of 1 (latest)

pine raptor
#
#import "@preview/cetz:0.4.1"

#cetz.canvas({
    import cetz.draw: line, mark
    line((0, 0), (1, 0), name: "x")
    mark("x", "x.end", anchor: "center", symbol: ("straight", "straight"))
})

I want the two marks to be centred on the line, but currently one is in the centre and the other mark is to the left. Setting the pos parameters makes both marks overlap each other, and setting offset moves the marks left but never right (even with a negative ratio).

#

?r

#import "@preview/cetz:0.4.1"

#cetz.canvas({
    import cetz.draw: line, mark
    line((0, 0), (1, 0), name: "x", stroke: white)
    mark("x", "x.end", anchor: "center", symbol: ("straight", "straight"), stroke: white)
})
pine raptor
#

As a temporarly fix, I’ve made the mark be at (name: "x", anchor: 60%), but that isn’t ideal

#

?r

#import "@preview/cetz:0.4.1"

#cetz.canvas({
    import cetz.draw: line, mark
    line((0, 0), (1, 0), name: "x", stroke: white)
    mark((name: "x", anchor: 60%), "x.end", anchor: "center", symbol: ("straight", "straight"), stroke: white)
})