Reference parameter in figure caption with Quarto
Question:
Is there a way to reference a parameter in a Quarto figure or table caption? In the example below, I am able to reference my input parameter txt
in a regular text block, but not in a figure caption. In the figure caption, only the raw text is displayed:
---
title: "example"
format: html
params:
txt: "example"
---
## I can reference it in text
Here I can reference an input parameter: `r params$txt`
```{r}
#| label: fig-example
#| fig-cap: "Example: I cannot reference a parameter using `r params$txt` or params$txt."
plot(1:10, 1:10)
```
Answers:
Is there a way to reference a parameter in a Quarto figure or table caption? In the example below, I am able to reference my input parameter txt
in a regular text block, but not in a figure caption. In the figure caption, only the raw text is displayed:
---
title: "example"
format: html
params:
txt: "example"
---
## I can reference it in text
Here I can reference an input parameter: `r params$txt`
```{r}
#| label: fig-example
#| fig-cap: "Example: I cannot reference a parameter using `r params$txt` or params$txt."
plot(1:10, 1:10)
```