如何在 knit word 的 R markdown 中居中图像 [英] How can I center image in R markdown in knit word
问题描述
我想在 knit word 的 R markdown 中居中图像.
I want to center image in R markdown in knit word.
我搜索的结果几乎是 CSS 或 HTML 代码.
I search result almost is CSSor HTML code.
但我需要文字中心图像.
But I need center image in word.
这是我的代码
![avatar](C:/Users/user/Desktop/picture1.jpg){ width=5cm }
谢谢!
推荐答案
我遇到了同样的问题,并使用我在文档开头声明的 .docx 文件模板设法解决了它:
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
---
只需打开您的模板文件,选择一个图形,然后按Ctrl + Shift + s 显示 Microsoft Word 的样式面板.将文本的对齐方式更改为居中".保存您的 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.
这篇关于如何在 knit word 的 R markdown 中居中图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!