Publication figures: math, a workflow diagram and labelled panels¶
This tutorial makes the parts of a typical theory-paper figure and puts them together: typeset math, a workflow diagram whose connectors route around its boxes, and a two-column figure of labelled panels as a PDF with embedded fonts.
You need vibe-sketcher with the publication extra for PDF and PNG output
(pip install 'vibesketcher[publication]'); SVG needs nothing more. The
commands run in an empty directory. Quote strings that hold $ in single
quotes, so the shell leaves them alone. The reference is
Cyclic topology, figure math and multi-panel figures.
1. Check the math first¶
Figure titles, captions, diagram labels and text objects take $...$
math: sub- and superscripts, Greek letters, \frac, \overline, \sum
and a few operators. Check a string before you use it:
vibe-sketcher figure math '$\Delta_r E = \sum_i \nu_i E_i$' --check
Δ_r E = ∑_i ν_i E_i
Anything outside the subset, or a glyph the publication font lacks, is
refused with the reason; nothing is dropped silently. Without --check, the
command writes the string as a tight SVG, PDF or PNG.
2. A workflow diagram¶
A diagram is a small spec of boxes and arrows. Download staged-recipe.toml, which draws vibe-sketcher’s publication baseline recipe. Its first lines choose the layout and the connectors:
schema = "vibesketcher.diagram/1"
layout = "layered"
direction = "down"
routing = "orthogonal"
title = "Publication baseline recipe"
Each [[nodes]] entry is a box with up to four label lines, math allowed;
[[edges]] are the arrows, with optional labels and dashes; a [[groups]]
entry draws a labelled frame around its members.
vibe-sketcher figure diagram staged-recipe.toml --check
vibe-sketcher figure diagram staged-recipe.toml -o staged-recipe.svg
--check lays the diagram out and prints a summary without drawing it:
7 nodes, 7 edges, 0 crossings and 0 bends. The layered layout puts every box
on the layer of its longest path from a start box. routing = "orthogonal"
draws every connector from horizontal and vertical segments that keep clear
of all boxes, with the fewest bends, and joins boxes that line up with one
straight segment. Leave it out for straight connectors.
The baseline recipe as a diagram.¶
Move a box with position = [x, y] and its connectors follow; a box that
would overlap another, or a box walled in so that no connector can reach
it, is refused with the reason.
3. The panels¶
Make three panels from structures: a powder pattern, a Brillouin zone and a crystal structure.
vibe-sketcher solid crystal fig.vsk --id nacl --prototype rocksalt --species Mg=Na --species O=Cl --a 5.640 --cell conventional
vibe-sketcher solid crystal fig.vsk --id nacl-p --prototype rocksalt --species Mg=Na --species O=Cl --a 5.640
vibe-sketcher solid powder-figure fig.vsk --structure nacl --b-iso Na=1.6 --b-iso Cl=1.2 --two-theta 20,80 --fwhm 0.1 --label-reflections 4 -o pattern.svg
vibe-sketcher solid figure fig.vsk --structure nacl-p --view isometric --brillouin -o zone.svg
vibe-sketcher solid figure fig.vsk --structure nacl --view top --polyhedra Na -o cell.svg
The zone is drawn for the two-atom primitive cell nacl-p: the zone of the
eight-atom conventional cell is a smaller cube, a folded zone (see
Brillouin zones and band paths).
Then compose them with the diagram, two to a row, at the double-column width of 178 mm:
vibe-sketcher figure panels pattern.svg zone.svg cell.svg staged-recipe.svg --columns 2 --column double --caption 'NaCl, Cu K$\alpha_1$' --caption 'primitive cell and first Brillouin zone' --caption 'NaCl$_6$ octahedra' --caption 'baseline recipe' --max-height-mm 80 -o figure.pdf
The composed figure (shown here as SVG; the command writes a PDF).¶
Panels are labelled (a), (b), … in reading order.
--labelschoosesa,a),(A),Aor none.--column singleis 85 mm,--column double178 mm, and--width-mmany width. The PDF’s page is exactly that wide and embeds the font.--max-height-mmkeeps a tall panel, such as the diagram, from setting the height of its whole row.--scale fit(the default) fits each panel to its cell.--scale angstromdraws every structure panel at one length scale and can add a common scale bar.Captions and
--titletake math, checked as in step 1.The same files always give the same bytes, so a figure can be rebuilt from its commands.
Where to go next¶
Cyclic-cluster schematics: a ring or torus drawn from a periodic structure.
Math in canvas text objects of a drawing: Math in text objects.
From Python:
vibesketcher.render.panels.compose_panelsandvibesketcher.render.diagram.diagram; over REST,POST /api/figures/panelsandPOST /api/figures/diagram; through MCP,compose_figure_panelsandfigure_diagram.