4
votes

I am editing a rmd file which will knit to a word document, I wonder how to align the image (a picture) as center, when I inserted it in rmd file and kint to word, the image aligned as light.

and when I used fig.align='center' in the code,

```{r color, echo=FALSE, fig.cap=figs("color")}
   knitr::include_graphics("../img/color.png")
```

it prompted me:

Warning message: In hook_plot(x[i], reduce_plot_opts(options)) : Chunk options fig.align, out.width, out.height, out.extra are not supported for Word output

1
It doesn't work for a word document. - Minyi Han

1 Answers

1
votes

one solution is to use officedown and set your YAML header like this:

---
output:
  officedown::rdocx_document:
    plots: 
      align: center
      
---

I believe center is the default with officedown::rdocx_document