Skip to content

Fix running header chapter prefix when lang is non-English - #3

Merged
cderv merged 1 commit into
mainfrom
fix/localize-running-header
May 19, 2026
Merged

cderv merged 1 commit into
mainfrom
fix/localize-running-header

Conversation

@cderv

@cderv cderv commented May 19, 2026

Copy link
Copy Markdown
Contributor

When rendering a Typst book with lang: set to a non-English locale, the running header keeps the English Chapter N. prefix instead of the locale's word (e.g. Chapitre N. for lang: fr).

The book() function exposes a supplement-chapter parameter that drives the running header via a show heading rule, but typst-show.typ was not forwarding Quarto's localized chapter prefix variable.

The line is gated on the template variable being defined, so the default English Chapter supplied by book()'s own default applies when the variable is unset (e.g., Quarto versions that do not yet surface this metadata, or non-Quarto consumers of the template).

Refs quarto-dev/quarto-cli#14524

The book() function exposes a supplement-chapter parameter that drives
the running header via a show heading rule. typst-show.typ did not
forward Quarto's localized chapter prefix variable, so the header
showed the default English "Chapter N." regardless of lang:.

The line is gated on the template variable being defined, so the
default English "Chapter" supplied by book()'s own default applies
when the variable is unset (e.g., Quarto versions that do not yet
surface this metadata, or non-Quarto consumers of the template).

Refs quarto-dev/quarto-cli#14524
@cderv
cderv merged commit b11e504 into main May 19, 2026
@cderv
cderv deleted the fix/localize-running-header branch May 19, 2026 10:58
cderv added a commit that referenced this pull request May 21, 2026
Switches supplement-chapter, list-of-figure-title, and list-of-table-title
to consume the new internal Pandoc template-variable namespace introduced
in quarto-dev/quarto-cli#14530. The flat $crossref-ch-prefix$ /
$crossref-lof-title$ / $crossref-lot-title$ forms relied on Quarto
copying values into Pandoc YAML metadata, which leaked into writers with
+yaml_metadata_block (markdown, native, json). The namespaced form is
delivered via the defaults-file variables: section and is not serialized
back to output by any writer.

list-of-figure-title and list-of-table-title use nested $if(...)$ guards
so that on pre-#14530 Quarto (or any non-Quarto consumer) where
$quarto.language.*$ is not populated, the argument is omitted entirely
and book()'s built-in default ("List of Figures" / "List of Tables")
applies. Without the nested guard the else-branch would pass an empty
string to book(), which is what PR #3's form effectively did too.

User-override path via the crossref: block ($crossref.lof-title$ /
$crossref.lot-title$) is preserved as the first cascade branch.

Supersedes the form introduced in #3 for supplement-chapter.
cderv added a commit that referenced this pull request May 21, 2026
Switches supplement-chapter, list-of-figure-title, and list-of-table-title
to consume the new internal Pandoc template-variable namespace introduced
in quarto-dev/quarto-cli#14530. The flat $crossref-ch-prefix$ /
$crossref-lof-title$ / $crossref-lot-title$ forms relied on Quarto
copying values into Pandoc YAML metadata, which leaked into writers with
+yaml_metadata_block (markdown, native, json). The namespaced form is
delivered via the defaults-file variables: section and is not serialized
back to output by any writer.

list-of-figure-title and list-of-table-title use nested $if(...)$ guards
so that on pre-#14530 Quarto (or any non-Quarto consumer) where
$quarto.language.*$ is not populated, the argument is omitted entirely
and book()'s built-in default ("List of Figures" / "List of Tables")
applies. Without the nested guard the else-branch would pass an empty
string to book(), which is what PR #3's form effectively did too.

User-override path via the crossref: block ($crossref.lof-title$ /
$crossref.lot-title$) is preserved as the first cascade branch.

Supersedes the form introduced in #3 for supplement-chapter.
cderv added a commit that referenced this pull request May 21, 2026
Switches supplement-chapter, list-of-figure-title, and list-of-table-title
to consume the new internal Pandoc template-variable namespace introduced
in quarto-dev/quarto-cli#14530. The flat $crossref-ch-prefix$ /
$crossref-lof-title$ / $crossref-lot-title$ forms relied on Quarto
copying values into Pandoc YAML metadata, which leaked into writers with
+yaml_metadata_block (markdown, native, json). The namespaced form is
delivered via the defaults-file variables: section and is not serialized
back to output by any writer.

list-of-figure-title and list-of-table-title use nested $if(...)$ guards
so that on pre-#14530 Quarto (or any non-Quarto consumer) where
$quarto.language.*$ is not populated, the argument is omitted entirely
and book()'s built-in default ("List of Figures" / "List of Tables")
applies. Without the nested guard the else-branch would pass an empty
string to book(), which is what PR #3's form effectively did too.

User-override path via the crossref: block ($crossref.lof-title$ /
$crossref.lot-title$) is preserved as the first cascade branch.

Supersedes the form introduced in #3 for supplement-chapter.
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.

1 participant