Skip to content

[Bug fixes] The same stroke styling is applied to a line and its marks #1054

@TimotheAlbouy

Description

@TimotheAlbouy

I haven't seen a GitHub issue mentioning this problem, and I don't know if this is an intended behavior of the last version, but the lack of documentation leads me to believe that this is a bug.

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)
  )
})
Image

Now, to reproduce the same result as that of 0.4.1, we have to explicitly reset the mark's styling, like so:

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

or

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

Related forum post: https://forum.typst.app/t/how-to-get-different-stroke-styles-for-a-line-and-its-mark-in-cetz-0-4-2/8264

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions