Search code examples
rbookdown

Caption styles for word_document2 in bookdown


I've got an .Rmd I need to output using the word_document2 format with R bookdown. It has a .docx template which works fine for heading styles etc.

However, it appears that the figure/table captions are output using the "normal" style, so I can't control the font, size etc. on them as a group and am having to go through after the fact and change them all by hand. Is there a way to get bookdown to designate them to use Word's "caption" style, or alternatively to specify a custom style for them?


Solution

  • In trying to make a reproducible example, I found the problem (apologies for not including an example in the first place).

    The issue wasn't with the .Rmd, but the reference .docx itself. It had a "Caption" style, but for some reason it didn't have "Image Caption" or "Table Caption" styles, which is what markdown was looking for. I copied those styles over from another Word document according to these instructions, and now it works fine.