#import "@preview/cetz:0.1.2" #import cetz.draw: * // quick reference // - `graphic` is for inline icons/images // - `canvas` is for centered more prominent stuff // - `group` can be used in either of ^, but not standalone #let graphic(what) = box({ cetz.canvas({ // any preamble-ish stuff can go here set-style( mark: (angle: 90deg) ) what }) }) #let canvas(what) = { align(center, graphic(what)) } // smaller stuff #let arrow(length: 1cm, lift: 4pt, stroke: 1pt) = graphic({ line((0, lift), (rel: (length, 0)), mark: (end: ">", stroke: stroke)) // hack for the bounding box bottom // so that `lift` even has any effect line((0, 0), (0, 0), stroke: none) }) // larger stuff #let nodes( distance: 3cm, arrow-spacing: 0.15cm, // cetz will support rounded rects in 0.2.0 style: (frame: "rect", padding: 0.1cm), ..labels, ) = group({ let labels = labels.pos() // draw each label itself for (i, label) in labels.enumerate() { if i != 0 { set-origin((distance, 0)) } content((0, 0), name: "label-" + str(i), label, ..style) } // then draw an arrow from each to each // since an arrow is between two, the last one can't be connected with the "next-to-last" one // so we leave it out for i in range(labels.len() - 1) { line( (rel: (arrow-spacing, 0), to: "label-" + str(i) + ".right"), (rel: (-arrow-spacing, 0), to: "label-" + str(i + 1) + ".left"), mark: (end: ">"), ) } }) #let stages-overview = canvas({ nodes( [Source], [Graph IR], [Runtime], ) }) // literally just for standalone display of the graphics alone #import "../template.typ": conf #show: conf