Hi !
I’m trying to create a loop in cetz.
I want to refer to contents in order to place some arrows.
Here is my code without loop :
content((0,0),[$u_0$],name:"u0")
content((1,0),[$u_1$],name:"u1")
content((2,0),[$u_2$],name:"u2")
content((3,0),[$u_3$],name:"u3")
content((4,0),[$...$],name:"u4")
bezier("u0.north-east","u1.north-west", (0.5,.6),mark:(end:"straight",length:0.08cm))
bezier("u1.north-east","u2.north-west", (1.5,.6),mark:(end:"straight",length:0.08cm))
bezier("u2.north-east","u3.north-west", (2.5,.6),mark:(end:"straight",length:0.08cm))
bezier("u3.north-east","u4.north-west", (3.5,.6),mark:(end:"straight",length:0.08cm))
content((0.5,.5),$+ r$)
content((1.5,.5),$+ r$)
content((2.5,.5),$+ r$)
content((3.5,.5),$+ r$)
Here’s what I tried :
for i in range(4) {
content((i,0),[$u_#i$],name:"u"+#i)
bezier(("u.i.north-east", 0.5, "u.(i+1).north-west"),mark:(end:"straight",length:0.08cm))
}
It doesn’t work that way.
I want to create names based on the loop and also to refer to those names in the loop.
I don’t know if I’m clear
Can someone help me ?
Thank you