在 Rmarkdown for Word 中,如何指定 r 输出的字体?

问题描述 投票:0回答:1

我发现这个关于如何为 Rmarkdown 文件使用指定字体的指南很有帮助,但它遗漏了我将用文本更改 R 块的字体/样式。我尝试了 2 个选项,如下面的示例 rmarkdown 脚本所示。第一次尝试运行但什么也没做;第二次崩溃。任何指导都会非常有帮助!

---
title: "test"
output: word
  reference_docx: my_styles.docx
date: "2024-04-25"
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

:::{custom-style="Style1"}
This works!
:::

:::{custom-style="Style1"}
```{r attempt 1}
cat(paste0("Wrapping an R chunk in the style runs," "but it doesn't apply the style!"))
```
:::

```{r attempt 2, custom-style="Style1"}
cat(paste0("Putting the style INSIDE the r brackets," "causes an error saying that R can't parse"))
```

r ms-word r-markdown
1个回答
0
投票

当前不支持将 Rmarkdown -> 中的字体更改为 Microsoft,但如果您想要导出为 PDF,则支持。

© www.soinside.com 2019 - 2024. All rights reserved.