Document setup

The contents below link to each definition. Function entries show the signature, then a description, then the parameters with their types and defaults; variable entries show the declared type.

Applies Mosaic’s presentation defaults and compiles headings and slide commands into pages.

setup(
  body,
  paper: "16-9",
  title: none,
  subtitle: none,
  authors: (),
  date: none,
  colors: (:),
  cells: (:),
  background: none,
  foreground: none,
  spacing: (:),
  overflow: "off",
  layouts: (:),
  handout: false,
  output: "slides",
  frozen-counters: (),
  frozen-states: ()
) -> content
Description

Install it as a document-wide show rule. Everything after it is presentation source: level-two headings become slides, and mosaic.slide commands become slides.

#import "@preview/mosaic:0.0.1" as mosaic
#show: mosaic.setup.with(
  title: [Tree-based slide grids],
  authors: [Ada Lovelace],
  date: [2026-08-03],
)

#mosaic.slide(layout: "title")

== First slide
Body content.

Deck metadata

title, subtitle, authors, and date are the deck’s canonical identity. They are written to Typst’s standard document metadata, stored in Mosaic’s rendering settings, and emitted as one queryable <mosaic-deck-metadata> record. Setup never creates a title slide by itself; mosaic.slide(layout: "title") inherits these values wherever the title layout’s own field is auto.

Partial overrides

colors, cells, spacing, and layouts are all partial: keys you omit keep the active theme’s value rather than reverting to a bare default. That is what lets a deck adjust one accent color or one layout without restating the theme.

Themes

This is the Default facade’s setup. A themed facade such as mosaic.themes.metropolis exposes the same signature with different defaults, and may add its own options on top. See theme.setup for binding a custom theme definition.

Arguments
bodycontent
The document body captured by the show rule.
paper

str
Slide aspect ratio.

  • "16-9": widescreen, the default.
  • "4-3": traditional projector.
titlecontent | str | none
Canonical deck title. Title layouts inherit it when their title is auto.
subtitlecontent | str | none
Canonical deck subtitle. Title layouts inherit it when their subtitle is auto.
authors

content | str | array
Canonical deck authorship. Title layouts inherit it when their own authors is auto. A name on its own is enough, so this reads like title and subtitle in the common case:

authors: [Ada Lovelace]
authors: ([Ada Lovelace], [Charles Babbage])

Wrap a name in layouts.author when it carries affiliations, an ORCID iD, or a contact address. Names and records mix in one array:

authors: (
  mosaic.layouts.author(
    [Ada Lovelace],
    affiliations: ([Analytical Society],),
    email: "ada@example.org",
    corresponding: true,
  ),
  [Charles Babbage],
)
datecontent | str | none
Canonical display date. Title layouts inherit it when their date is auto.
colors

dictionary
Partial semantic color overrides layered over the active theme. Omitted roles keep the theme’s value.

  • canvas: the slide page behind everything else.
  • surface: raised panels, such as component frames and callouts.
  • text: ordinary body text.
  • muted: subtitles, captions, and other fine print.
  • line: rules, borders, and other drawn separators.
  • accent: the deck’s one emphatic color.
colors: (accent: rgb("#0072B2"))
cells

dictionary
Partial fallback content keyed by cell ID, used whenever a slide leaves that cell empty. Every key names a grid cell, for example footer or body; the full-slide planes have their own options below.

A slide’s explicit content overrides these values, and none on the slide suppresses a configured default. Defaults targeting cells absent from a resolved grid are ignored, so one footer default is safe across layouts that have no footer.

cells: (footer: align(right, mosaic.components.progress()))
background

content | str | none
The deck’s background plane, drawn behind the grid on every slide. A slide inherits it unless it passes its own background:, or none to suppress it. The plane takes no space away from the grid.

background: mosaic.components.image(path("paper.webp"))
foreground

content | str | none
The deck’s foreground plane, drawn over the grid on every slide. Ordinary home for a logo, a slide number, or a progress indicator.

foreground: place(bottom + right, mosaic.components.progress())
spacing

dictionary
Partial overrides for the grid geometry the layouts measure with. Omitted keys keep the theme’s value.

  • inset: padding inside a cell, default 1.25em.
  • gap: space between grid regions, default 0.7em.
  • compact-gap: the tighter space inside stacked metadata, default 0.35em.

Typographic rhythm is not here. Heading spacing and list spacing are ordinary show and set rules owned by the theme, so change them with native rules after setup or in your own theme’s apply.

overflow

str
What to do when a cell’s content is taller than the cell.

Observation measures every cell on every frame, which roughly doubles the layout work a deck does, so it is off by default and switched on for a deliberate checking pass rather than left on while you write.

  • "off": observe nothing. The default.
  • "record": emit queryable <mosaic-overflow-warning> metadata and keep compiling. Typst gives a package no warning channel, so nothing is printed; this mode is for tooling that reads the records itself.
  • "error": emit the same metadata and fail the compile, naming every offending cell. Run this before presenting, so a build stops rather than shipping a clipped slide.
layouts

dictionary
Partial named-layout overrides. Omitted names keep the active theme’s layout.

  • content: the ordinary slide layout, also used by automatic level-two-heading slides.
  • title: used by slide(layout: "title").
  • section: used by slide(layout: "section") and by automatic level-one heading slides.

Each value is either a deferred mosaic.layouts.* value or a low-level mosaic.grids.* tree. Note that this option is distinct from the cells: option above, which supplies inherited cell content rather than structure.

layouts: (
  content: mosaic.layouts.content(variant: "header-body", columns: 2),
)
handoutbool
Whether to emit only the final frame of each logical slide, collapsing every incremental reveal into one page for printing.
output

str
Which document to render.

  • "slides": the presentation itself.
  • "speaker": each frame above the notes that apply to it.
  • "notes": the notes alone, without the slide image.
  • "split": each frame beside its notes on a double-width page, the layout pympress and pdfpc cut in half to drive two screens.
frozen-counters

array
Counters restored to their pre-slide values before each continuation frame, so content repeated across the frames of one logical slide advances them once rather than once per frame.

frozen-counters: (counter(figure.where(kind: image)),)
frozen-statesarray
States restored to their pre-slide values before each continuation frame, the state counterpart of frozen-counters.