Closed 3akev closed 3 weeks ago
Not an answer, just adding to the issue: it would be great if you could simply use cetz coordinates and anchors directly, as well as fletcher's "elastic coordinates". Cetz already has great support for relative, polar, tangent/perpendicular coordinates, etc.
I'm not sure how that could be implemented technically, though. @johannes-wolf may have ideas about how other packages could add custom coordinate systems to cetz.
@Jollywatt, you want to be able to register some kind of custom coordinate handler that translates a given coordinate to a vector? I guess we could add something like this. I think we should create a cetz ticket for this.
As of v0.5.0, this will be possible with CeTZ-style relative coordinates:
#diagram({
node((0, 0), [root], name: <r>)
node((rel: (1, 0), to: <r>), [child1], name: <c1>)
edge(<c1>, <r>)
node((rel: (0, 1), to: <c1>), [child2], <c2>)
})
It would be really nice if something like this was possible:
Where, for example,
node
can take a label which determines a base position, and a string to move the node relative to the given position, similar to howedge
works.As shown in this example, this allows easily chaining and reusing nodes, in code mode, without having to define variables.