How to include both Alt text and Caption in a figure to Knit to Word with RMarkdown?

Hi Community!
I'm a R newbie and this is my first post here. I'm using the code below to add a caption to a figure that will be knit into Word. Once I knit the doc, the caption is correctly added to the figure however, this same caption ends up in the Description field of the Alt Text box in Word.
How can I replace the caption that is being written in the Description field by a real alt text, which differently from a caption is supposed to be a more descriptive text of the figure?

Thank you so much! Any insights on how to improve the code or change it completely will be much appreciated.
Laura

{r,echo=FALSE, fig.cap = paste0("Figure 1: figCaption")}
Fig1 <- knitr::include_graphics("my_directory/figure.jpeg")

This is currently not possible using directly knitr. See https://github.com/yihui/knitr/issues/1967

However, if you use directly the markdown syntax that Pandoc supports and you only output word document this could work.

![Figure 1: figCaption](my_directory/figure.jpeg "Description")

Can you try this ?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.