NewsCrawler.org

Florilegium: Procedural Flowers in LaTeX

Florilegium is a LaTeX package that draws procedural Delft-blue floral page margins in Lua, with no images or external assets: every petal, leaf and stem is a parametric curve computed while the page is being written, painted like a watercolor and written straight into the PDF. It was made in response to a Reddit post asking how to draw similar flowers; the author does not know how the original was made and does not try to reproduce it, instead using hand-authored primitives with randomized parameters and a procedural layout whose space-filling borrows a 1998 idea from the ornament literature. The same code with a different seed[1] fills whatever space the text leaves free, so every page gets its own garden.

Options extend the decoration: an initial whose letter outline is read from an OpenType font (Latin Modern Bold by default) and painted like a petal with a vine crossing its strokes, flowers in the margin beside numbered headings, a flower beside any line via \florilegiumbloom, and an aging option in which the garden goes from spring buds on the first page to autumn seed heads on the last. Most pages get visitors — butterflies, bees and a snail, and on about one page in five a bird on a twig. The whole palette is derived from one color, with the ramp from the darkest stroke to the palest wash computed in OKLCH[2] so the light end never turns gray. make grow-6 renders a growth animation of one seed as a GIF and MP4 of about 45 seconds.

A PostScript port packs the same garden into one self-contained file that Ghostscript or a printer computes while interpreting the page, taking about 2.5 seconds for its two pages. Layers, transparency and randomness do not transfer directly: fills and strokes are captured with pathforall[3] into per-layer lists and replayed at the end, translucent fills need Ghostscript's -dALLOWPSTRANSPARENCY or are mixed opaque, and single-precision reals mean seed 7 in PostScript grows a different garden from seed 7 in LaTeX. The package builds with LuaLaTeX[4] in one pass at about a second a page, with Docker and Overleaf instructions included.

Read the original github.comDiscussion

Discussion

Most commenters praise the idea, the visuals and the technical detail, some saying they had no idea animations in LaTeX or PDF were possible. A few find the AI-written text of the README grating, and one feels sad that the author of the original Reddit post did not want the work copied. Others point to procedural decorations made for a recreation of Byrne's 'Elements of Euclid' and describe converting the package into an Obsidian extension that uses the file name as the seed.

Sources

Published: First seen: Читать по-русски

Open as a page