Jollywatt / typst-fletcher

Typst package for drawing diagrams with arrows, built on top of CeTZ.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Place node label above the node

augustebaum opened this issue · comments

Hi,

I'm trying out fletcher and struggling to place a node's label above it. I don't see any example of this in the docs; can this be done somehow?

Thanks in advance, fletcher seems really powerful apart from that. I really appreciate the integration with touying!

Hmm. You could do this by manually moving the label, like this:

#diagram(
  node-stroke: 1pt,
  node((0,0), $A$, radius: 5mm),
  edge("-|>"),
  node((1,0), move(dy: -8mm, $B$), radius: 5mm)
)

Alternatively, you could make the node label its own node, and position it separately:

#diagram(
  node-stroke: 1pt,
  node((0,0), $A$, radius: 5mm),
  edge("-|>"),
  node((1,0), radius: 5mm),
  node((1,-.5), $B$, stroke: none)
)

Is that what you mean? If so, I don’t think this should be added as a built-in feature, since it would make things too complicated without needing to.

Thanks for the quick response! I'm happy with these two solutions, I just wanted to make sure I wasn't missing some idiomatic way of doing it. Thanks again :)