How can I place a node relative to another node or its outline in fletcher?

Hi. This is covered in the “Node anchors” section of the manual.

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

#let badge(pos, body, ..args) = {
  body = text(size: 10pt, body)
  node(pos, shape: circle, fill: white, inset: 2pt, ..args, body)
}

#diagram({
  node((0, 0), name: <this>, shape: rect, stroke: 1pt)[test]
  badge(<this.north-east>, stroke: 1pt)[2]
})

image

2 Likes