Repository navigation
Description
With #15077, fig-alt on Mermaid and Graphviz diagrams is now honored in HTML, revealjs, DOCX and Typst output. It is still lost in LaTeX output (pdf, beamer), while a regular figure in the same document gets its alt text.
---
format:
pdf:
keep-tex: true
---
```{dot}
//| label: fig-dot
//| fig-cap: "A Graphviz diagram"
//| fig-alt: "Graphviz alternative text"
digraph G { A -> B }
```
```{mermaid}
%%| label: fig-mermaid
%%| fig-cap: "A Mermaid diagram"
%%| fig-alt: "Mermaid alternative text"
flowchart LR
A --> B
```
{#fig-image fig-alt="Image alternative text"}The .tex file has no alt key for the two diagrams:
\includegraphics[width=5.5in,height=3.5in]{repro_files/figure-latex/dot-figure-1.png}
\includegraphics[width=2.13in,height=0.73in]{repro_files/figure-latex/mermaid-figure-1.png}
\pandocbounded{\includegraphics[keepaspectratio,alt={Image alternative text}]{image.png}}Same result with beamer (the example from #9003), and for diagrams without label or without caption.
The diagram handlers write fig-alt on the generated image. For Typst, it is converted to alt on the image here:
quarto-cli/src/resources/filters/quarto-post/typst.lua
Lines 218 to 223 in 0e28ab3
| -- to the image caption. fig-alt is Quarto's alt text override. | |
| local fig_alt = image.attributes[kFigAlt] | |
| if fig_alt then | |
| image.attributes["alt"] = fig_alt | |
| image.attributes[kFigAlt] = nil | |
| end |
It seems nothing does the same for LaTeX on this path. Regular captioned figures work because they go through the figure handling, but the diagram output doesn't benefit from it even with a caption.
This is close to #14315 (fig-alt lost for LaTeX non-float images), but not the same case: a captioned diagram also loses it, while a captioned image does not. We could check whether one LaTeX-side conversion fixes both.
Part of #14348.
Activity
fig-altnot propagated to output across multiple formats #14348