0

我正在使用 RMarkdown 创建一个 Word 文档,其中包含几个句子,其中插入了数字作为内联 R 块。我想使用不间断空格作为千​​位分隔符,但似乎无法找到这样做的方法。我找到了 HTML 和 PDF 输出的解决方案,但不是 Word 输出的解决方案。

---
output: word_document
---

This is a long sentence with some numbers, so I would like to use non-breaking spaces as thousands separator. For instance, in the number `r formatC(1234, big.mark = " ")`.

任何帮助将非常感激。

4

2 回答 2

2

您可以使用其 Unicode 转义符输入不间断空格,即 formatC(1234, big.mark = "\ua0").

于 2020-04-17T11:58:01.577 回答
0

另一种方法是"\ ". 但是,这并不总是有效。

它什么时候起作用?在正常的 Markdown 文本中。

什么时候不起作用?如果您在块的 cat-command 或 paste-command 中使用它。

不过,我不知道为什么。

所以最好留下来"\ua0"

于 2021-06-13T19:39:37.833 回答