4

I need to get Quarto to put figure captions above the figure, rather than the default (below).

Following the documentation I used this:

---
title: "Test title"
format: docx
fig-cap-location: top
---

```{r}
#| label: fig-test
#| fig-cap: This caption should be above the figure
plot(cars)
'``

However, this renders like so:

enter image description here

I see that some people have resorted to LaTeX customisations or knit hooks, however I'm also failing at those (and I don't understand why the simple YAML marker I used, that is recommended in the documentation, isn't working).

Edit: as Mael pointed out, fig-cap-location is not an option for docx outputs. The Quarto documentation has since been amended to clarify this.

Andrea M
  • 2,314
  • 1
  • 9
  • 27

1 Answers1

0

If you check the list of MS Word options, fig-cap-location is not actually one of them (compared to e.g., PDF options), so this option is just not available with a docx output.

Maël
  • 45,206
  • 3
  • 29
  • 67
  • 1
    I see. So I guess my question is, how do I do this with a docx output? – Andrea M Oct 31 '22 at 12:42
  • 4
    It's going to be hard. You **might** be able to do this by writing a Lua filter for pandoc https://pandoc.org/lua-filters.html , but that's a pretty deep rabbit hole. You could open a wishlist item at the [quarto issues list](https://github.com/quarto-dev/quarto-cli/issues) but, again, I wouldn't hold my breath ... See https://github.com/quarto-dev/quarto-cli/issues/2221 – Ben Bolker Oct 31 '22 at 13:32