4

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

Minyi Han
  • 807
  • 1
  • 8
  • 15

1 Answers1

1

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

JD Long
  • 59,675
  • 58
  • 202
  • 294