-
Notifications
You must be signed in to change notification settings - Fork 410
Description
This was previously discussed in
but I think it deserves its own issue.
This is a temporary issue because UA-2 does much smarter MathML interpretation of equations, where you no longer need alt text.
It's highly likely that Typst will implement UA-2 later this year.
Description
Quarto currently supports alt text for display math equations via {#eq-label alt="..."} (added in #13889), but there is no mechanism for adding alt text to inline math expressions. This causes PDF/UA-1 validation failures when documents contain inline math like $a$, $f(x)$, or $a^2 + b^2 = c^2$ in Typst output.
Typst's PDF/UA-1 mode requires every math.equation element (including inline) to have an alt parameter. Without a way to specify this from Quarto markdown, any document with inline math will fail UA-1 validation.
Current state
- Display math with labels: ✅ Supported via
{#eq-label alt="..."} - Display math without labels: ❌ No mechanism
- Inline math: ❌ No mechanism
Steps to Reproduce
---
format:
typst:
pdf-standard: ua-1
---
For a right triangle with legs $a$ and $b$ and hypotenuse $c$: $a^2 + b^2 = c^2$Each inline math expression produces: error: PDF/UA-1 error: missing alt text
Impact
In testing Quarto book extensions (bookly, ilm, wonderous-book) with pdf-standard: ua-1, after fixing all image and display equation alt text, the only remaining errors are inline math — 30 errors per project, all from theorem/definition content containing inline variables and formulas.
Possible approaches
- Span syntax: Allow
[$a$]{alt="a"}to propagate thealtattribute to the generated Typstmath.equation - Auto-generation: Automatically generate alt text from the math source (e.g.,
$a$→alt: "a",$a^2 + b^2 = c^2$→alt: "a^2 + b^2 = c^2") — the LaTeX/Typst source is often a reasonable alt text for simple expressions - Global show rule: Emit a Typst show rule like
show math.equation: set math.equation(alt: ...)if the document usespdf-standard: ua-1— though Typst currently doesn't support settingaltvia show rules
Note: Typst plans to support MathML-based accessibility in PDF 2.0 which would make manual alt text unnecessary, but for PDF/UA-1 the alt parameter is the only option.