How to get different stroke styles for a line and its mark in CetZ 0.4.2?

The behavior of line stroke styling has changed between CetZ 0.4.1 and CetZ 0.4.2, as shown below. In the latest version, the stroke styling of a line is also applied to its marks, which wasn’t the case in previous versions.

#import "@preview/cetz:0.4.1": canvas, draw

CetZ 0.4.1:
#canvas({
  import draw: *
  line((0, 0), (2, 0),
    stroke: (dash: "dashed"),
    mark: (end: ">", scale: 1.2)
  )
})

#import "@preview/cetz:0.4.2": canvas, draw

CetZ 0.4.2:
#canvas({
  import draw: *
  line((0, 0), (2, 0),
    stroke: (dash: "dashed"),
    mark: (end: ">", scale: 1.2)
  )
})

Is this a bug? How to reproduce the upper arrow in CetZ 0.4.2?

that does look like a bug and i would recommend opening an issue, but for now you can override the mark’s stroke style like this:

mark: (end: ">", scale: 1.2, stroke: (dash: none))

perhaps:

set-style(mark: (stroke: (dash: none)))
1 Like

Opened an issue: [Bug fixes] The same stroke styling is applied to a line and its marks · Issue #1054 · cetz-package/cetz · GitHub

1 Like