# Snippets & wrappers

Snippets are reusable source blocks: figures, tables, equations, algorithms, theorem environments or recurring prose. Wrappers surround selected text with a template while keeping that text as the wrapper's content.

## Insert a built-in block

Open **Snippets** in the left sidebar (with Bibliography and Figures), from the tools menu, or press **⌘ShiftI**. The library opens beside the sidebar, over the edge of the manuscript; Escape or × closes it. Choose a card or drag it onto LaTeX source or a gap in Visual mode.

A snippet creates a new block at the insertion point. A wrapper uses the text you selected. The drop marker indicates where the block will go. If a block is accidentally dropped into the preamble, insertion can be redirected to the beginning of the document body.

Built-ins cover ordinary/full-width/wrapped figures, multi-image arrangements, several table styles, math environments, lists, theorem blocks, algorithms and reusable passages. Treat them as editable starting points rather than a mandatory paper style.

## Pick figure assets

Figure templates open a searchable image picker immediately. Search workspace images and inspect thumbnails. **Browse this computer** copies an external image into the project's figure folder with a collision-safe name; the original is left in place.

Multi-image templates accept an ordered selection. Reorder the images before inserting to keep panels and captions consistent. Cancelling leaves the source unchanged. VersoFold remembers the drop location by its surrounding source while the picker is open; stale locations require care rather than blind insertion.

After insertion, edit the caption and label. Refer to the figure using `\ref{fig:label}` instead of writing a fixed number.

## Review packages and labels

The insertion form shows the expanded source, packages not yet loaded by the document root, and potentially duplicated labels. **Add to the preamble** inserts missing package declarations while preserving existing package options. **Suggest unique labels** helps avoid duplicate cross-references.

For example, a booktabs-style table needs `booktabs`; a wrapped figure may need `wrapfig`. Adding the environment without its required package can produce an undefined-command error. Read the generated source so you understand what the template adds.

An insertion is one normal editor change. Undo reverses it, autosave persists it, and Review changes treats it like other source edits. Editing the template later does not rewrite blocks that were already inserted.

## Build your own reusable collection

Duplicate a built-in to adapt its source, name and shortcut. Save personally when you want it in every workspace, or in the paper when collaborators should receive it with the folder. Personal templates live in `~/.versofold/templates.json`; paper templates live in `.versofold.templates.json`.

A saved template that reuses a built-in ID customizes that built-in. Deleting that saved customization restores the built-in. Use distinct duplicates when you want both variants available.

Favorite common cards and group them into collections such as “Conference paper”, “Thesis” or “Rebuttal”. Select a preferred collection and default figure/table wrappers for the workspace. Import/export creates portable JSON bundles for transferring templates.

## Expand shortcuts

Type a template shortcut in the source editor and press **ControlSpace** to open its expansion form. Examples may include `fig`, `tabb` and `algo`, depending on the saved collection. The expansion form lets you inspect source and resolve required fields before inserting.

A practical workflow is to maintain a small collection of venue-compatible blocks, insert them with shortcuts, and customize the scientific content after insertion. Keep analytical data in Figure Studio or the table editor when you need repeatable generation rather than a static hand-edited table.

Related: [Figure Studio](figures.md), [table editor](tables.md), [LaTeX techniques](latex-advanced.md).
