How to set alternative texts in Typst output using ggplot? #13596
Replies: 3 comments 8 replies
-
|
I think I have my answer, according to https://quarto.org/docs/reference/formats/typst.html#figures , |
Beta Was this translation helpful? Give feedback.
-
|
My understanding is that Alt text support is coming in Typst in next 0.14 version through Accessibility in PDF update: https://staging.typst.app/docs/changelog/0.14.0 Work was done in This is not yet available in Quarto, and also Pandoc needs to adapt for sure. |
Beta Was this translation helpful? Give feedback.
-
|
Reading again the issue, I know see this is a ggplot and knitr issue in a way. This is the intermediate markdown output for the first cell ::: {.cell}
```{.r .cell-code}
library(ggplot2)
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
labs(alt = "example alt text")
```
::: {.cell-output-display}

:::
:::You can see that with a not to propagate to knitr, but I don't think this is yet done. So the issue won't probably be with typst but all format. Though they did provide a retreiver function ```{r}
#| fig-alt: !expr last_alt
library(ggplot2)
p <- ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
labs(alt = "example alt text")
last_alt <- ggplot2::get_alt_text(p)
p
```Leading to ::: {.cell}
```{.r .cell-code}
library(ggplot2)
p <- ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
labs(alt = "example alt text")
last_alt <- ggplot2::get_alt_text(p)
p
```
::: {.cell-output-display}
{fig-alt='example alt text'}
:::
:::
This is because that options like So what is really missing is for |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Hi!
I'm trying to set the alternative text in images from ggplot output using Typst format. The issue is, I couldn't find a way to add alt text. For instance, none of the following work:
(relevant) typst output is:
I wish it would be:
In ggplot we're supposed to use
labs(alt="hello"), but this might be different when using Quarto. But it seems thatfig-altdoes not work either.Maybe I misunderstood this section in the doc (or maybe it's just for for Jupyter?).
Beta Was this translation helpful? Give feedback.
All reactions