The desired caption style required by most of journals is:
Figure 1. Text of figure caption
There is a very close solution proposed by @crsh, which is to apply a custom Lua filter:
function Image (img)
img.caption[1] = pandoc.Strong(img.caption[1])
img.caption[3] = pandoc.Strong(img.caption[3])
img.caption[4] = pandoc.Strong(". ")
return img
end
(Assuming that img.caption[2] is the white space between Figure and the number and img.caption[4] is the white space between the number and the caption)
Place this filter in a file called figure_caption_patch.lua in the directory of the rmarkdown document so that you can apply it by adding a pandoc argument in the YAML front matter:
I think you get this behavior because we changed the output to have a : as separator by default. It was suppose to be there and it was not. It is possible that we revert back this change because you are not the first one to be impacted by this.
However, you can now do that with R directly, no need of Lua.
As you see you can pass Markdown syntax to obtain the Strong type.
Would that work for you ?
Otherwise, you we need to replace the sep : if it exists using Lua function. I guess indexing by number is not robust to any change in the default caption. (string.gsub should work in Lua for example)
This is to be set in a _bookdown.yml file which is picked up by a bookdown project. Usually this is used with a book project, but it works also with a single document format like bookdown::word_document2
Unfortunately We don't yet support bookdown: key or else in YAML header.
If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: