Cross-references
Label a block, caption it, and point at it.
A compiled block is a Quarto cross-reference target like any other. Three options do the work:
labelnames the block, and its prefix selects the reference type.capis the caption below it.altis the text for a reader who cannot see the image.
A figure
```{typst}
//| label: fig-shapes
//| cap: "A circle and a square, drawn by Typst."
//| alt: "A blue circle beside an orange square."
#stack(
dir: ltr,
spacing: 1em,
circle(radius: 1cm, fill: blue.lighten(60%)),
rect(width: 2cm, height: 2cm, fill: orange.lighten(60%)),
)
```
See @fig-shapes.See Figure 1.
A table
The prefix of the label decides the type, so a tbl- label gives a table, numbered in its own series:
```{typst}
//| label: tbl-formats
//| cap: "How each writer receives a block."
//| alt: "A table of three output formats and how each one receives a block."
#table(
columns: 2,
[*Writer*], [*Receives*],
[html], [image],
[latex], [image],
[typst], [native or image],
)
```
@tbl-formats lists them.Table 1 lists them.
Every Quarto prefix works the same way, lst- and the custom types a document declares included.
Prefix-specific captions
cap and alt apply to any label. The prefixed forms, fig-cap, tbl-cap, lst-cap, and their alt counterparts, say the same thing for one type:
//| label: fig-example
//| fig-cap: "A caption for a figure."
//| fig-alt: "Alternative text for a figure."A prefixed option takes precedence over the generic one when the label matches its type. Write cap and alt unless a document already uses the prefixed names.
Reference the filter by name, with no at: stage. Pinning it to one stage breaks cross-referencing, because the labels must be in place before Quarto numbers them.