r - 为 Rmarkdown 标题创建类似作者的添加
问题描述
我Rmarkdown
用来创建一个.docx
文件。
我想指定用于一些文本的 Word 样式。通常它默认为First Paragraph
(不知道为什么),但我希望它默认为Normal
并可以选择其他内置样式之一(例如Compact
或Body Text
)。
标题:
---
title: "Report title"
output:
word_document:
toc: yes
reference_docx: "SMC-Style.docx"
---
我已将 设置SMC-Style.docx
为模板并根据需要格式化所有样式。我只是不知道如何使特定的文本部分使用这些样式。我可以得到标题 1-6(使用#
等##
),但不知道如何为其他样式做同样的事情,例如Body Text
.
我试过的:
我试图重现这里的例子,但没有一个奏效
[Test1 - this is 'First Paragraph' style]
[Test2 - Still 'First Paragraph' style]{#Normal}
[Test3 - Still 'First Paragraph' style]{custom-style = #Normal}
::: {#Normal}
Test5 - Still 'First Paragraph' style
:::
::: {custom-style = #Normal} Test4 - Still 'First Paragraph' style :::
似乎没有什么能改变与这些文本相关的风格。任何人都可以帮忙吗?
会话信息:
R 版本 3.6.1、RStudio 版本 1.1.456 和 rmarkdown v1.18,在 Office 2013 中输出到 Word。
解决方案
这可能是您的 yaml 标头的问题,请尝试将您的标头编辑为此
toc: true
reference_docx: SMC-Style.docx
推荐阅读
- mysql - MacOS High Sierra MySQL 错误:设置值时出错
- excel - 将所有对象移回excel VBA用户表单中的原始位置
- c# - 如何获得结果我的代码显示错误的结果
- angular - 如何在 Angular Mat-Select 中动态禁用特定选项
- javascript - 找不到创建反应应用程序模块:错误:无法解析模块'child_process'
- java - 访问另一个类中的 config.properties 文件
- tensorflow - 如何在 DNN 分类器中使用未标记的测试数据
- nginx - nginx 上的重定向太多
- amp-html - 在 iPhone 上预加载 amp 运行时显示站点冻结
- django - TemplateDoesNotExist 即使路径设置正确