Technology1 min read

Florilegium: Procedural Flowers in LaTeX

By · Published by Everything Blog

In short

Florilegium generates procedural margin illustrations inside LaTeX documents using hand-authored primitives and randomized parameters executed in Lua. The system evaluates unused space with a 1998 ornament layout algorithm, starting with base stems before running a greedy loop to sprout branches in unoccupied regions. To ensure clean aesthetics, the engine calculates its visual palette from a single base color via the OKLCH color space while populating margins with visiting creatures like bees and birds. Beyond standard document borders, the underlying growth loops and drawing engine have also been translated into a standalone PostScript file.

Key points

  • Botanical motifs can adapt across a document to show seasonal progression, shifting from…: Botanical motifs can adapt across a document to show seasonal progression, shifting from spring buds to autumn seeds.
  • The software interacts directly with text elements to decorate initial letters, numbered…: The software interacts directly with text elements to decorate initial letters, numbered headings, and individual lines.
  • The drawing engine and procedural growth loops function independently within a standalone…: The drawing engine and procedural growth loops function independently within a standalone PostScript file.

Sources checked by our analysis pipeline: 1

The Reddit post asked how to make flowers like these in LaTeX. I don't know how the original was made, and this project doesn't try to reproduce it. It is one possible way, and the way I did it: hand-authored primitives with randomized parameters, painted in Lua, placed by a procedural layout whose "fill the unused space" part borrows a 1998 idea from the ornament literature. It gets a similar look.

Procedurally generated Delft-blue floral page margins for LaTeX. No images, no imported paths, no external assets: every petal, leaf and stem is a parametric curve computed in Lua while the page is being written, painted like a watercolor, and written straight into the PDF. Every page gets its own garden.

Six seeds of the grown composition. Same code, different seed — and the garden fills whatever space the text leaves free.

Two documents share one package, and a third shows what else it does:

Both PDFs are self-describing: the body text is the write-up of how the margin is drawn.

Last page of the grown document: the text ends…

Technology