Skip to content

Support alt text for inline math #14111

@gordonwoodhull

Description

@gordonwoodhull

Pandoc does not allow alt text for inline equations, at the AST level.

This may be a temporary issue because UA-2 does much smarter MathML interpretation of equations, where you no longer need alt text.

But there will be a transitionary period, as seen in

where some tools and readers may still need UA-1 alt text for equations, even when UA-2 mathml is available.

LaTeX implements UA-2, and it's highly likely that Typst will implement UA-2 later this year.

q2 support free-floating attribute blocks, so this is directly fixable with no new syntax there. For Pandoc we'd need to invent a new syntax. ☹️

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

  1. Span syntax: Allow [$a$]{alt="a"} to propagate the alt attribute to the generated Typst math.equation
  2. 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
  3. Global show rule: Emit a Typst show rule like show math.equation: set math.equation(alt: ...) if the document uses pdf-standard: ua-1 — though Typst currently doesn't support setting alt via 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.

Metadata

Metadata

Labels

accessibilitymathany issue related to math support in specific formatstypst

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions