paolobrasolin / string-diagrams

Create string diagrams with LaTeX!
https://www.ctan.org/pkg/string-diagrams
LaTeX Project Public License v1.3c
13 stars 2 forks source link

Shape with configurable anchors #2

Closed paolobrasolin closed 1 year ago

paolobrasolin commented 1 year ago

We currently have a box shape inheriting from rectangle with four additional hardcocoded anchors: west0, west1, east0 and east1.

It would be very nice to have a configurable number of anchors (like star) so we can handle any number of wires on any side.

E.g. something like

\node[box, box anchors=0/1/2/3] (f) {f};

would create 0, 1, 2, and 3 0-indexed anchors on the north, east, south and west sides respectively. So, we could refer to f.e.0, f.s.0, f.s.1, f.w.0, f.w.1 and f.w.2 and get an undefined label error for free if we get them wrong.

Alternatives could be more explicit anchor names (e.g. f.east.0), and more specific tikz keys (e.g. box anchors east).