cetz icon indicating copy to clipboard operation
cetz copied to clipboard

Centering dashed strokes (like TikZ's `dash expand off`)

Open cAttte opened this issue 3 months ago • 0 comments

hi! it would be cool to have an equivalent of TikZ's dash expand off that "centers" the dashes of a stroke such that both of its edges have equal spacing, which can result in nicer lines (e.g. the bottom line here looks a little weird)

code
#import "@preview/cetz:0.4.2"

#cetz.canvas({
  import cetz.draw: *
  set-style(mark: (symbol: "|", stroke: (dash: none)), stroke: (dash: "dashed"))
  line((0pt, .2), (53pt, .2))
  line((0pt, 0), (62pt, 0))
})
Image

cAttte avatar Oct 17 '25 05:10 cAttte