Skip to content

fig-alt value disappears in Typst when using fig-align and no caption or crossref #14187

@andrewheiss

Description

@andrewheiss

I have:

  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide

Bug description

The fig-alt value for computational cells disappears when using fig-align on a non-cross-referenced or caption-less figure in Typst.

(This might be related to or a side effect of #8767)

Steps to reproduce

Here's a base minimal reprex document. I'll make little modifications to it in the next section:

---
title: "Testing"
format:
  typst:
    keep-typ: true
---

```{r}
#| fig-alt: "Informative alt text here"

plot(1:10)
```

Actual behavior

fig-alt is correctly passed to Typst only under these conditions:

  • No fig-align in a chunk with no caption and no crossref ID
  • Yes fig-align in a chunk with a caption
  • Yes fig-align in a chunk with a crossref ID

The fig-alt attribute disappears in a chunk with fig-align and no caption or no crossref ID


Here are some examples…

Working correctly: fig-alt, no fig-align, no caption, no crossref

This document:

---
title: "Testing"
format:
  typst:
    keep-typ: true
---

```{r}
#| fig-alt: "Informative alt text here"

plot(1:10)
```

…creates Typst like this:

#box(image(
  "testing_files/figure-typst/unnamed-chunk-1-1.svg", 
  alt: "Informative alt text here"
))

Not working fig-alt and fig-align, no caption, no crossref

If the chunk uses fig-align:

---
title: "Testing"
format:
  typst:
    keep-typ: true
---

```{r}
#| fig-alt: "Informative alt text here"
#| fig-align: "center"

plot(1:10)
```

…it creates Typst like this, with no alt attribute:

#align(center)[#box(image("testing_files/figure-typst/unnamed-chunk-1-1.svg"))]

Working correctly: fig-alt and fig-align and caption

If fig-cap is included, the alt text works again:

---
title: "Testing"
format:
  typst:
    keep-typ: true
---

```{r}
#| fig-alt: "Informative alt text here"
#| fig-align: "center"
#| fig-cap: "Some caption"

plot(1:10)
```

…produces this Typst:

#figure([
#box(image(
  "testing_files/figure-typst/unnamed-chunk-1-1.svg", 
  alt: "Informative alt text here"
  ))
], caption: figure.caption(
position: bottom, 
[
Some caption
]), 
kind: "quarto-float-fig", 
supplement: "Figure", 
)

Working correctly: fig-alt and fig-align and crossref

Things also work correctly when not using a caption, but when using a fig- cross-reference ID:

---
title: "Testing"
format:
  typst:
    keep-typ: true
---

```{r}
#| label: fig-thing
#| fig-alt: "Informative alt text here"
#| fig-align: "center"

plot(1:10)
```

…this creates this Typst:

#figure([
#box(image("testing_files/figure-typst/fig-thing-1.svg", alt: "Informative alt text here"))
], caption: figure.caption(
separator: "", 
position: bottom, 
[
#block[
]
]), 
kind: "quarto-float-fig", 
supplement: "Figure", 
)
<fig-thing>

Expected behavior

The value of fig-alt should probably not disappear when doing this:

```{r}
#| fig-alt: "Informative alt text here"
#| fig-align: "center"

plot(1:10)
```

Your environment

  • IDE: Positron Version: 2026.03.0 build 212
  • OS: macOS Tahoe 26.3.1

Quarto check output

❯ quarto check
Quarto 1.9.29
[✓] Checking environment information...
      Quarto cache location: /Users/andrew/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.8.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.4.5: OK
      Typst version 0.14.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.9.29
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (external install)
      VeraPDF: 1.28.2
      Chromium: (not installed)
      Chrome Headless Shell: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/andrew/Library/TinyTeX/bin/universal-darwin
      Version: 2025

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
      Source: MacOS known location

[✓] Checking basic markdown render....OK

[✓] Checking R installation...........OK
      Version: 4.5.2
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/andrew/Library/R/arm64/4.5/library
        - /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
      knitr: 1.50
      rmarkdown: 2.30

[✓] Checking Knitr engine render......OK

[✓] Checking Python 3 installation....OK
      Version: 3.13.1
      Path: /Users/andrew/.virtualenvs/quarto/bin/python3
      Jupyter: 5.7.2
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking Julia installation...

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions