简体   繁体   中英

How to Center Figure Caption in RMarkdown Word Output

I cannot figure out how to center a figure caption in RMarkdown with MS Word output. I'm pointing the Markdown document to a reference Word template, and the figure captions in the template are correct. The problem is that RMarkdown doesn't know that the captions are supposed to be captions. It's treating them as just normal text.

---
title: "Title"
author: "Author"
date: "June 5, 2020"
output:
  bookdown::word_document2:
    fig_caption: yes
    reference_docx: Template.docx
subsubtitle: Test
subtitle: Subtitle
---

# My Plots

Sample Plot

{r pressure,fig.cap="Sample Caption", echo=FALSE}
plot(pressure)

How do I tell RMarkdown that "Sample Caption" is actually figure text and not just normal text?

Try specify fig.id = "pressure" and it should generate automatically numbered captions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM