簡體   English   中英

如何在 RMarkdown Word output 中使用不間斷空格作為千位分隔符?

[英]How to use non-breaking spaces as thousands separator in RMarkdown Word output?

我正在使用 RMarkdown 創建一個 Word 文檔,其中包含多個句子,其中插入了數字作為內聯 R 塊。 我想使用不間斷空格作為千位分隔符,但似乎無法找到這樣做的方法。 我找到了 HTML 和 PDF 輸出的解決方案,但不是 Word output 的解決方案。

---
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 = " ")`.

任何幫助將非常感激。

您可以使用其 Unicode 轉義符輸入不間斷空格,即formatC(1234, big.mark = "\ua0")

另一種方法是"\ " 但是,這並不總是有效。

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

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

不過,我不知道為什么。

所以最好留在"\ua0"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM