Replies: 5 comments 4 replies
-
My working example can be found at: https://raw.githubusercontent.com/friendly/Vis-MLM-book/master/test/minimal-example.qmd |
Beta Was this translation helpful? Give feedback.
-
The inline R inside code cell is never going to work in Quarto or even in RMarkdown. You need markdown (or use the knitr specific feature with An helper could be to use the following extension: https://github.com/mcanouil/quarto-highlight-text #| fig-cap: 'This is [Red]{colour="#b22222"}.' The above is not tested. The #| fig-cap: !expr sprintf('This is %s.', colorize('red')) |
Beta Was this translation helpful? Give feedback.
-
Thanks so much @mcanouil for pointing me to For writing figure captions,
But there is an even better solution that makes such captions easier to write, by defining global variables with color names and using them with
Then this works:
Or just with
|
Beta Was this translation helpful? Give feedback.
-
My complete example is now at: https://raw.githubusercontent.com/friendly/Vis-MLM-book/master/test/caption-colors.qmd |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
In figure captions, it is often useful to say refer to colored objects in graphs by printing
the words in their colors: e.g.,
"The blue points show the data values. The regression line is shown in green, while the loess smooth is shown in red"
In the working example below, I can color words in text using an inline R expression,
r colorize("red")
, which works both for HTML and PDF output. However, this does not work in a figure caption. I realize that this may involvepandoc
, but I'd like to find a solution that works. Can anyone help?My working example:
This doesn't work:
Beta Was this translation helpful? Give feedback.
All reactions