本文介绍了将 RMarkdown 中的图像居中以进行 Word 导出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 RMarkdown 文档中包含一个图像,并使其在输出 Word 中居中.
I would like to include an image in a RMarkdown document and have it centered in the output Word.
这可能吗?
按照此处的建议,我用过:
<center>![My caption](myImage.png)</center>
没有成功.
推荐答案
这个还不是很满意,不过我最后做的就是在我的样式文档中加了一个宏:
This is not fully satisfactory, but what I did in the end was to add a macro in my styles document:
Sub Center_All_Images()
'
' Center_All_Images Macro
'
'
For Each oILShp In ActiveDocument.InlineShapes
oILShp.Select
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Next
End Sub
我仍然需要手动运行宏.我希望它在从模板创建文档时自动运行.
I still need to run the macro manually. I wish it was run automatically when the document is created from the template.
这篇关于将 RMarkdown 中的图像居中以进行 Word 导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!