Support node names
Closed this issue · 3 comments
jneug commented
It would be great if nodes could be named and the names be used as coordinates. Since CeTZ supports these kind of references, I would hope this feature could be easily implemented.
This would allow something like this:
#node((0,0), "Start", name:"start")
#node((10,0), "End", name:"end")
#edge("start", "ende")
Jollywatt commented
I've deliberately not done this so far, encouraging the use of variables instead:
#fletcher.diagram({
let (start, end) = ((0,0), (10,0))
node(start, "Start")
node(end, "End")
edge(start, end)
})
I'm not sure there's a significant advantage to using node names over variables.
jneug commented
It's personal preference, I guess.
Jollywatt commented
I’ve had a change of heart and finally added this. The motivation is partly to prepare to later support edges connecting edges (#16), but that’s still a concept.
Now you can do things like:
#fletcher.diagram(
node((0,0), $frak(A)$, name: <A>),
node((1,0), $frak(B)$, name: <B>),
edge(<A>, <B>, "-->")
)
I went with labels, not strings, so node names can be more easily disambiguated as positional arguments.