Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to add inline code to #| fig-cap: in quarto

This is a working quarto exmple:

---
title: "test"
format: revealjs
---

## Quarto example


```{r}
#| label: fig-plot_mtcars
#| fig-cap: nrow(mtcars).

plot(mtcars$mpg, mtcars$disp)
```

output:

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

How can I add a inline code to fig.cap::
desired output:
enter image description here

I have tried with #| fig-cap: paste("bla", nrow(mtcars))

>Solution :

You’ll need to tell the quarto YAML that you’re parsing an R expression to be evaluated. I.e.:

#| fig-cap: !expr nrow(mtcars)

For reference, see:

https://quarto.org/docs/computations/r.html#chunk-options

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading