Repository navigation
Description
Bug description
When _brand.yml defines a logo, Typst output puts it in the page background of every page, and logo: false does not remove it, neither as a typst format option nor at the top level of the front matter.
revealjs honors logo: false with the same _brand.yml, and websites and books document it for navbar and sidebar (https://prerelease.quarto.org/docs/authoring/brand.html#disabling-the-logo).
For Typst, the only document-level switch I found is brand: false, which also drops the brand colors and fonts.
Steps to reproduce
_brand.yml
logo:
images:
mark:
path: logo.svg
alt: Logo
small: marklogo.svg
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect width="100" height="100" fill="#d33"/></svg>doc.qmd
---
title: Logo test
format:
typst:
logo: false
---
First page paragraph.
{{< pagebreak >}}
Second page paragraph.quarto render doc.qmd -M keep-typ:true
grep "set page(background" doc.typSame result with logo: false at the top level instead of under typst, and without logo at all.
Actual behavior
doc.typ always contains
#set page(background: align(left+top, box(inset: 0.75in, image("/logo.svg", width: 1.5in, alt: "Logo"))))and the red square is drawn on both pages of the PDF.
Expected behavior
logo: false removes the logo in Typst output, while the rest of _brand.yml still applies.
Cause
The Typst format passes the document logo through fillLogoPaths() before resolveLogo():
quarto-cli/src/format/typst/format-typst.ts
Lines 122 to 123 in d5e0617
| const logo = fillLogoPaths(typstBrand, logoSpec, sizeOrder); | |
| format.metadata[kLogo] = resolveLogo(typstBrand, logo, sizeOrder); |
resolveLogo() handles false since #13922 (for navbar and sidebar):
quarto-cli/src/core/brand/brand.ts
Lines 360 to 373 in d5e0617
| if (spec === false) { | |
| return undefined; | |
| } | |
| if (!spec) { | |
| const lightLogo = findLogo("light", order); | |
| const darkLogo = findLogo("dark", order); | |
| if (!lightLogo && !darkLogo) { | |
| return undefined; | |
| } | |
| return { | |
| light: lightLogo || darkLogo, | |
| dark: darkLogo || lightLogo, | |
| }; | |
| } |
but fillLogoPaths() turns any falsy value into undefined first:
quarto-cli/src/core/brand/brand.ts
Lines 593 to 595 in d5e0617
| if (!spec) { | |
| return undefined; | |
| } |
So resolveLogo() receives undefined and falls back to the first brand logo of small, medium, large, which the page.typ partial then sets as page background:
quarto-cli/src/resources/formats/typst/pandoc/quarto/page.typ
Lines 13 to 14 in d5e0617
| $if(logo)$ | |
| #set page(background: align($logo.location$, box(inset: $logo.inset$, image("$logo.path$", width: $logo.width$$if(logo.alt)$, alt: "$logo.alt$"$endif$)))) |
We could let false pass through fillLogoPaths() unchanged so the existing check in resolveLogo() applies.
Workaround
A Typst file in include-in-header that wraps article() and resets the background before any content:
#let quarto-article = article
#let article(..args) = {
set page(background: none)
quarto-article(..args)
}format:
typst:
include-in-header: no-logo.typIt resets any other page background too. A plain #set page(background: none) in include-before-body comes after the title block and adds an extra page.
Your environment
- Quarto 1.12.0 (prerelease), also 1.11.9
- Windows 11
Activity