How can I center image in R markdown in knit word

我怕爱的太早我们不能终老 提交于 2020-05-27 12:12:33

问题


I want to center image in R markdown in knit word.

I search result almost is CSSor HTML code.

But I need center image in word.

This my code

![avatar](C:/Users/user/Desktop/picture1.jpg){ width=5cm }

Thanks!


回答1:


I encountered the same problem and managed to solve it using a .docx file template that I declared at the beginning of the document:

---
output:
    word_document:
        reference_docx: template.docx
---

Just open your template file, select a figure, then press Ctrl + Shift + s to display the style panel for Microsoft Word. Change the alignment style of the text to "centered". Save your template.docx then knit your document as usual.



来源:https://stackoverflow.com/questions/49657662/how-can-i-center-image-in-r-markdown-in-knit-word

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!