Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions llm-docs/pandoc-quarto-typst-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Combines Pandoc definitions with Quarto-specific functionality:
- Code block styling (gray background, padding, rounded corners)
- `block_with_new_content` helper for reconstructing blocks with modified content
- `empty` function to check if content is empty (handles strings and content nodes)
- Subfloat support via `quartosubfloatcounter` and `quarto_super` function for nested figures with sub-numbering
- Subfloat support via `quartosubfloatcounter` and `quarto_super` function for nested figures with sub-numbering; subfloats are `outlined: false`, so only the parent appears in a list of figures
- Callout figure show rule that transforms callout figures with proper titles and cross-reference numbering
- `callout` function for rendering callout boxes with customizable colors, icons, and styling

Expand All @@ -106,14 +106,15 @@ Corresponds to `conf()` in Pandoc's `template.typst`. Defines the `article()` fu
- `title-size`, `subtitle-size` for customizable title sizing
- `heading-family`, `heading-weight`, `heading-style`, `heading-color`, `heading-line-height` for brand typography
- `toc`, `toc_title`, `toc_depth`, `toc_indent` for integrated table of contents
- `lof`, `lof-title`, `lot`, `lot-title` for lists of figures and tables (outlines of `quarto-float-fig` / `quarto-float-tbl` figures)

**Functionality**:
- Sets `document()` metadata (title, keywords, author string) for PDF accessibility
- Configures paragraph justification and leading from `linestretch`
- Applies conditional font settings using `set ... if` pattern (Typst 0.14+)
- Applies link colors using `content-to-string` helper
- Renders the title block with thanks footnote, author grid, date, and abstract
- Optionally renders table of contents
- Optionally renders table of contents, then lists of figures and tables
- Handles single or multi-column layout

### page.typ - Page Configuration
Expand Down Expand Up @@ -143,6 +144,7 @@ Applies the `article()` function via a show rule, mapping Pandoc metadata and br
- `linkcolor`, `citecolor`, `filecolor` → link color parameters
- `keywords` → `keywords`
- `toc`, `toc-title`, `toc-depth`, `toc-indent` → TOC parameters
- `lof`, `lot` → `lof`, `lot`; titles from `crossref.lof-title` / `crossref.lot-title`, else `quarto.language.crossref-lof-title` / `crossref-lot-title` (localized)
- `columns` → `cols`

**Brand.yaml Fallbacks** (used when Pandoc metadata not set):
Expand Down Expand Up @@ -210,3 +212,7 @@ This is the copy of Pandoc's `default.typst`, kept for reference. It is used whe
| `toc-title` | `toc_title` | - | |
| `toc-depth` | `toc_depth` | - | |
| `toc-indent` | `toc_indent` | - | Quarto extension |
| `lof` | `lof` | - | Quarto extension (Pandoc's Typst writer ignores it) |
| - | `lof-title` | - | `crossref.lof-title`, else `quarto.language.crossref-lof-title` |
| `lot` | `lot` | - | Quarto extension (Pandoc's Typst writer ignores it) |
| - | `lot-title` | - | `crossref.lot-title`, else `quarto.language.crossref-lot-title` |
1 change: 1 addition & 0 deletions news/changelog-1.11.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ All changes included in 1.11:
### `typst`

- ([#11683](https://github.com/quarto-dev/quarto-cli/issues/11683)): Fix `unknown font family` warnings, and wrong fonts, when a `font-family` list or brand typography uses a CSS generic family (`serif`, `sans-serif`, `monospace`, `cursive`, `fantasy`, `math`, `system-ui`, `ui-*`). Typst has no generic families, so each one is now replaced by the first installed font from a list of well-known candidates, and the keyword is no longer passed to Typst. No fonts are bundled.
- ([#14081](https://github.com/quarto-dev/quarto-cli/issues/14081)): Support `lof` and `lot` in Typst documents, which previously had no effect. The list titles follow `lang` and can be set with `crossref: lof-title` and `lot-title`.
- ([#14847](https://github.com/quarto-dev/quarto-cli/pull/14847)): Fix `toc_title` auto-fallback in typst outline template that was ignoring the computed fallback value when `toc_title` is `none`.
- ([#14947](https://github.com/quarto-dev/quarto-cli/issues/14947)): Fix Typst compilation failing with `invalid number suffix: px` when an image with alt text (`fig-alt`, `alt`, or an inline image caption) has its `width` or `height` in pixels. These images are now written by Pandoc's Typst writer like other images, which also fixes URL-encoded image paths and unsupported size units for them.

Expand Down
1 change: 1 addition & 0 deletions src/resources/formats/typst/pandoc/quarto/definitions.typ
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
subfloat-numbering(n-super, subfloat-idx)
})
show figure.where(kind: kind): set figure.caption(position: position)
show figure.where(kind: kind): set figure(outlined: false)

show figure: it => {
let num = numbering(subcapnumbering, n-super, quartosubfloatcounter.get().first() + 1)
Expand Down
8 changes: 8 additions & 0 deletions src/resources/formats/typst/pandoc/quarto/typst-show.typ
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,13 @@ $if(toc-indent)$
toc_indent: $toc-indent$,
$endif$
toc_depth: $toc-depth$,
$if(lof)$
lof: true,
lof-title: [$if(crossref.lof-title)$$crossref.lof-title$$else$$quarto.language.crossref-lof-title$$endif$],
$endif$
$if(lot)$
lot: true,
lot-title: [$if(crossref.lot-title)$$crossref.lot-title$$else$$quarto.language.crossref-lot-title$$endif$],
$endif$
doc,
)
16 changes: 16 additions & 0 deletions src/resources/formats/typst/pandoc/quarto/typst-template.typ
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
toc_title: none,
toc_depth: none,
toc_indent: 1.5em,
lof: false,
lof-title: none,
lot: false,
lot-title: none,
doc,
) = {
// Set document metadata for PDF accessibility
Expand Down Expand Up @@ -135,6 +139,18 @@
]
}

if lof {
block(above: 0em, below: 2em)[
#outline(title: lof-title, target: figure.where(kind: "quarto-float-fig"));
]
}

if lot {
block(above: 0em, below: 2em)[
#outline(title: lot-title, target: figure.where(kind: "quarto-float-tbl"));
]
}

doc
}

Expand Down
30 changes: 30 additions & 0 deletions tests/docs/smoke-all/typst/lof-lot-false.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: "No lists without lof and lot"
toc: true
format: typst
_quarto:
tests:
typst:
ensurePdfRegexMatches:
- - 'Table of contents'
- - 'List of Figures'
- 'List of Tables'
---

# Introduction

Without `lof` or `lot`, no list of figures or tables is printed, even though the document has a figure, a table and a table of contents.

::: {#fig-one}

CONTENT

A figure caption

:::

| a | b |
|---|---|
| 1 | 2 |

: A table caption {#tbl-one}
35 changes: 35 additions & 0 deletions tests/docs/smoke-all/typst/lof-lot-lang.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: "Localised list titles"
lang: fr
lof: true
lot: true
crossref:
lot-title: "Mes tableaux"
format: typst
_quarto:
tests:
typst:
ensurePdfRegexMatches:
- # French default title for figures, crossref override for tables
- 'Liste des Figures[\s\S]*Une figure[\s\S]*Mes tableaux[\s\S]*Un tableau'
- - 'List of Figures' # English default must not leak through
- 'Liste des Tables' # crossref lot-title must win over the language title
---

# Introduction

With `lang: fr`, the figure list takes its title from the French language file, while `crossref: lot-title` replaces the language title of the table list.

::: {#fig-one}

CONTENU

Une figure

:::

| a | b |
|---|---|
| 1 | 2 |

: Un tableau {#tbl-one}
62 changes: 62 additions & 0 deletions tests/docs/smoke-all/typst/lof-lot.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: "List of figures and tables"
lof: true
lot: true
format: typst
_quarto:
tests:
typst:
ensurePdfRegexMatches:
- # Both lists are rendered with their entries, before the body
- 'List of Figures[\s\S]*A figure caption[\s\S]*List of Tables[\s\S]*A table caption[\s\S]*Introduction'
# The subfigure parent stays in the list
- 'List of Figures[\s\S]*Parent with subfigures[\s\S]*List of Tables'
# Cross-references to a subfigure keep their sub-numbering
- 'See Figure 2a'
- # Subfigure captions are not listed between the list title and the body
- 'List of Figures[\s\S]*Subcaption A[\s\S]*Introduction'
---

# Introduction

With `lof: true` and `lot: true`, a list of figures and a list of tables are printed after the title block and before this heading, as in LaTeX output (#14081).

Subfigures are left out of the list of figures, as in LaTeX: only their parent is listed. A cross-reference to a subfigure still shows its sub-numbering.

See @fig-sub-a.

::: {#fig-one}

CONTENT

A figure caption

:::

:::: {#fig-sub layout-ncol=2}

::: {#fig-sub-a}

CONTENT A

Subcaption A

:::

::: {#fig-sub-b}

CONTENT B

Subcaption B

:::

Parent with subfigures

::::

| a | b |
|---|---|
| 1 | 2 |

: A table caption {#tbl-one}
Loading