-
Is it possible to define multiple figure captions for multiple tables/figures in one R code block? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 2 replies
-
Yes, see the docs here: https://quarto.org/docs/authoring/figures.html#figure-captions If you use an array of |
Beta Was this translation helpful? Give feedback.
-
Could you provide the full source code for the example that's giving you this error? I tried the following and it works as expected: ```{r}
#| label: fig-charts
#| fig-cap: ["Cars", "Pressure"]
#| layout-ncol: 2
plot(cars)
plot(pressure)
``` |
Beta Was this translation helpful? Give feedback.
-
Thank you for you attention in this matter. The example you provided works in my environment as well. It seems that the error is being through when gt or kable tables are involved. Both examples below generate the error
It's worth noting that the following works as expected
And, interestingly, so does this (though, obviously, the same caption is applied to both tables and the label placement/orientation is not the same as the plot example, but I assume that can be tweaked)
I realize both of these table functions have their own means of providing captions. I was just hoping I might be able to standardize captioning across charts/plots and tables in a single quarto document. |
Beta Was this translation helpful? Give feedback.
-
Okay, I see the problem. For tables you need to use |
Beta Was this translation helpful? Give feedback.
-
The problem is the space you have left at the top of the chunk (it invalidates all of the options). This works: |
Beta Was this translation helpful? Give feedback.
-
Ah .... thank you. |
Beta Was this translation helpful? Give feedback.
The problem is the space you have left at the top of the chunk (it invalidates all of the options). This works: