Skip to content

Support lof and lot in Typst documents - #15001

Merged
cderv merged 3 commits into
mainfrom
lof-in-format-typst-doesnt-produce-a-list-of-fig
Oct 7, 2026
Merged

cderv merged 3 commits into
mainfrom
lof-in-format-typst-doesnt-produce-a-list-of-fig

Conversation

@cderv

@cderv cderv commented Oct 6, 2026

Copy link
Copy Markdown
Member

Standalone Typst documents ignore lof: true and lot: true, although the schema advertises both options for Typst. The default template only maps toc into article(), and Pandoc only honours lof and lot for LaTeX, ConTeXt and docx, so nothing was ever rendered (#14081).

This adds both lists to the default Typst template, after the table of contents and before the body, as in LaTeX output. They are Typst outlines targeting Quarto's float kinds, quarto-float-fig and quarto-float-tbl, because Quarto emits floats with those kinds instead of Typst's native image and table. Titles use the lookup LaTeX already uses: crossref: lof-title / lot-title, else the localized crossref-lof-title / crossref-lot-title language strings.

Design

The lists are rendered inside article() rather than by a show rule, so a format that overrides typst-show.typ keeps control. orange-book draws its own lists inside book() and does not get a second set.

Subfigures are left out of the list of figures in a second commit. Subfloats have the same kind as their parent, so they were listed as separate "Figure 2a" / "Figure 2b" entries. LaTeX lists only the parent, and subpar, which quarto_super is adapted from, defaults to outlined-sub: false. The rule is scoped to the parent's body, so the parent stays listed and references to a subfigure keep their sub-number. Since definitions.typ is shared, this also applies to formats that reuse it for their own lists, such as orange-book.

An extension that ships its own typst-template.typ together with Quarto's typst-show.typ gets unexpected argument: lof only when lof is set. This is the same contract toc-indent already has.

This covers standalone documents only. The book case needs a fix in the orange-book package first (it looks for kind: image and kind: table), so #14081 stays open for that.

Part of #14081

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

cderv added 2 commits October 6, 2026 18:05
The schema has advertised lof and lot for Typst since book support
landed, but the default Typst template never acted on them: only the
TOC was mapped into article(), and Pandoc's own Typst template has no
lists of figures or tables either. Setting them silently did nothing.

The lists are rendered inside article(), right after the TOC, so a
format that overrides typst-show.typ (orange-book draws its own lists
inside book()) keeps control and does not get a second set. The
outlines target Quarto's float kinds, since Quarto emits floats as
figure(kind: "quarto-float-fig") and figure(kind: "quarto-float-tbl"),
not Typst's native image/table kinds.

Titles use the lookup LaTeX already uses: crossref lof-title /
lot-title, else the language's crossref-lof-title / crossref-lot-title.

An extension that ships its own typst-template.typ with Quarto's
typst-show.typ gets "unexpected argument: lof" only when lof is set,
the same contract toc-indent already has.

Refs #14081
Subfloats are figures of the same kind as their parent, so the new
list of figures listed "Figure 2a" and "Figure 2b" as separate entries
after "Figure 2". LaTeX lists only the parent, and subpar, which
quarto_super is adapted from, defaults to outlined-sub: false.

The rule is scoped to the parent's body, so the parent stays listed,
and it only affects outlines: references to a subfigure still render
its sub-number.

This also applies to formats that reuse definitions.typ for their own
lists, such as orange-book.

Refs #14081
@posit-snyk-bot

posit-snyk-bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv
cderv merged commit b311ccd into main Oct 7, 2026
8 of 10 checks passed
@cderv
cderv deleted the lof-in-format-typst-doesnt-produce-a-list-of-fig branch October 7, 2026 10:35
cderv added a commit to quarto-dev/quarto-web that referenced this pull request Oct 7, 2026
The cross-references page only described LaTeX raw commands for lists of figures and tables, and the Typst page said nothing, although the options were already advertised for Typst. Quarto 1.11 makes them work for Typst documents, so the Typst page gets a section for them and the cross-references page points to it.

The custom formats page notes the new template parameters, since a custom typst-template.typ that reuses Quarto's typst-show.typ fails with "unexpected argument: lof" when the option is set and the template does not accept it.

Companion to quarto-dev/quarto-cli#15001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants