Why does this Fletcher Cetz decorations code fail

I am trying to draw a basic Feynman diagram and fine-tune the photon wave line, but the example given in the manual on how to use Cetz decorations doesn’t compile. When I try this MWI:

#set page(
  height: auto,
  width: auto,
  margin: 5mm
)

#import "@preview/cetz:0.4.2"
#import "@preview/fletcher:0.5.7" as fletcher: diagram, node, edge

#diagram( $
     A edge("wave") &
     B edge("zigzag") &
     C edge("coil") & D \
     alpha &&& omega
   $,
   edge((0,1), (3,1), "<->", decorations:
     cetz.decorations.wave
       .with(amplitude: .4)
))

all I get back is the following error:

Within @preview/cetz:0.4.2 this problem occured:

cannot destructure float

Why does this happen?

I would at this point just prefer to make the diagram directly in Cetz, but I cannot figure out how fletcher makes the fermion line arrows in the example they have on their page:

#import "@preview/fletcher:0.5.8" as fletcher: diagram, node, edge
#set page(width: auto, height: auto, margin: 5mm, fill: white)

#diagram(
	mark-scale:130%,
$
	edge("rdr", overline(q), "-<|-")
	edge(#(4, 0), #(3.5, 0.5), b, "-<|-")
	edge(#(4, 1), #(3.5, 0.5), overline(b), "-<|-", label-side:#left) \
	& & edge("d", "-<|-") & & edge(#(3.5, 0.5), #(2, 1), Z', "wave") \
	& & edge(#(3.5, 2.5), #(2, 2), gamma, "wave") \
	edge("rru", q, "-|>-") & \
$)

This fails because fletcher 0.5.7 depends on cetz 0.3.4, but you are also using cetz 0.4.2 to apply decorations. This isn’t usually important, but cetz introduced changes to the way it represents path data between those two versions.

You should generally keep the cetz version in sync with fletcher if you use them together, for example by importing cetz with:

#import "@preview/fletcher:0.5.7" as fletcher: diagram, node, edge, cetz
1 Like

Ugh, of course it’s a dependency issue. Thanks.