-
| DescriptionI would like to use dynamic figure and table captions in quarto documents, e.g. In   | 
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
| You have to use Quarto syntax as described in https://quarto.org/docs/computations/r.html#chunk-options. #| fig-cap: !expr 'paste("Air", "Quality")'I am changing this discussion to Q&A. | 
Beta Was this translation helpful? Give feedback.
-
| You can also use the older knitr syntax, which is less constrained by Yaml limitations  | 
Beta Was this translation helpful? Give feedback.
-
| Thanks @mcanouil I'll try it out, I understand the post is old but it's also where google directed me! So hopefully, it will help others in the future. | 
Beta Was this translation helpful? Give feedback.
This thread is very old.
As with recent version of Quarto, I would highly recommend to avoid
!exprwhich is knitr specific and can lead to very weird syntax.Use the cross-reference div syntax and inline code.
::: {#<prefix>-<whatever-name>} ```{language} Code ``` The caption with `{language} code`. :::@fig-{{var}}is not an R expression in your case.What you provide to
!exprstill needs to be valid R code.