Primitives
Everything in pic is built from a handful of primitives. Each one draws itself at the current position, then moves the current position along the current direction — so a plain sequence of primitives already makes a diagram.
.PS
box
arrow
circle
arrow
ellipse
.PEClosed objects
box, circle and ellipse are closed: they have an interior you can
fill, and text placed on them is centered by default.
.PS
box "box" wid 0.8 ht 0.55
move right 0.3
circle "circle" rad 0.32
move right 0.3
ellipse "ellipse" wid 0.9 ht 0.55
.PEOpen objects
line, arrow, spline and arc are open: they are paths. A path can
have several segments chained with then, and arrowheads at either end.
.PS
line right 0.7 then up 0.4 then right 0.7
arrow right 0.6 "label" above
move right 0.3
spline right 0.5 then up 0.4 then right 0.5 then down 0.4 then right 0.5
.PEarc draws a quarter-circle by default, counter-clockwise; cw flips it.
.PS
circle rad 0.035 fill 0
arc rad 0.35 from Here
move right 0.55
circle rad 0.035 fill 0
arc cw rad 0.35 from Here
move right 0.55
circle rad 0.035 fill 0
arc -> cw rad 0.35 from Here
.PEmove — the invisible primitive
move advances the current position without drawing. It participates in
layout exactly like a line, which makes it the standard spacer.
.PS
box "a"
move right 0.5
box "b"
.PEText is an object too
A quoted string on its own places text; several strings stack as lines.
.PS
box "attached" "to a box"
move right 0.55
"loose text"
move right 0.55
box "another"
.PEWhere to go next
- Positioning — the current point,
at/with, anchors - Attributes — sizes, dash patterns, colors, arrowheads