Files
Superfig/references/layout.md
T
dela db5598fbf7 feat: add superfig paper-figure toolkit
Standalone LaTeX/TikZ skill for non-tensor paper figures: node/edge
macros, lint-on-warning build, golden examples, and negative fixtures.
2026-08-17 09:40:12 +08:00

53 lines
2.2 KiB
Markdown

# Layout rules
## Cursor flow
Inside `\sfrow` … `\sfrowend`, objects are placed from left to right by the cursor.
The first object starts on the left rail; every later object reserves the standing gutter.
- Declare the band height once in `\sfrow`. An object that overflows it is a build warning.
- Use `\sfconn` for a labelled edge in the flow; the label reserves its own width.
- Do not add magic-number `xshift`s between flow objects.
## Fixed topology
Use `\sfnode[at={(x,y)}]{...}` only when the diagram is genuinely non-linear: branches,
loops, vertical/horizontal stacks, skip edges.
- Keep coordinates on a coarse grid; prefer multiples of `\sfgutter` or explicit anchors.
- Use `\sfarrow` between placed nodes. Route edges on the background layer.
- Put edge labels on the edge itself, not floating nearby.
## Captions
Use `\sflane{row}` after `\sfrowend` to give all captions in that row one shared baseline.
Symbol and detail lines are two reserved lanes; do not place other text between them.
## Groups
A group outline adds inner padding, so place it after its members. It must not cover unrelated
nodes. Members must be adjacent in the semantic sense; the explicit fit list prevents the
package from inventing a group around whatever is near. A group must bind at least two
members.
After a `\sfrow`, `\sfgroup` refits that row so `\sflane{row}` hangs captions below the
outline. Prefer an empty overlay caption and `\sfcaption{group}{...}{...}`: an overlay at
the north-west corner lands on skip edges. A connector that should leave the composite
starts on the group node (`\sfarrow{block.east}{next.west}`), not on a member — otherwise
the shaft crosses an outline that is not its endpoint.
## Formula
Call `\sftopformula` after the last `\sfrowend`. The line is centered on `\sfbbox`, whose
width is only known once the bands exist.
## Callouts
`\sfcallout` hangs off a finished `\sfrow` band, one per figure. It is not an object in
the flow and must not be anchored to a single node.
## Meaning box
The meaning box hangs below the full figure bbox (`\sfbbox`). It is one column, at most
three rows. If it is too long, remove content; do not widen it past the figure or shrink type.