如何在officer R markdown Word文档的block_caption中包含希腊符号?

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

我试图在officer R包中的block_caption()中包含希腊符号(写入docx),但希腊符号没有格式化。

我已经尝试过:

--
title: 'Test'
output:
  officedown::rdocx_document:
  html_document:
    df_print: paged
includeline-num: true
---

# Test
  
```{r test, echo=FALSE, fig.height=6, fig.width=6}

#from https://stackoverflow.com/questions/54915628/restart-figure-numbering-for-appendix-supplementary-material-in-bookdown
officer::block_caption("\\sigma",
                       style = "Figure",
                       autonum = officer::run_autonum(seq_id = 'suppfig', 
                                                      bkm = 'test',
                                                      pre_label = "Supplementary Figure ",
                                                     start_at=NULL))

```

但是,当我将其编织到Word中时,标题仅在“\sigma”处输出。谁能提供正确的解决方案,因为我在任何地方都找不到?谢谢!

r r-markdown officer
1个回答
0
投票

添加 sigma 符号的一种选择是使用它的 UTF-8 代码 =

\u003c

---
title: 'Test'
output:
  officedown::rdocx_document:
  html_document:
    df_print: paged
includeline-num: true
---

# Test
  
```{r test, echo=FALSE, fig.height=6, fig.width=6}
# from https://stackoverflow.com/questions/54915628/restart-figure-numbering-for-appendix-supplementary-material-in-bookdown
officer::block_caption("\u03c3",
  style = "Figure",
  autonum = officer::run_autonum(
    seq_id = "suppfig",
    bkm = "test",
    pre_label = "Supplementary Figure ",
    start_at = NULL
  )
)
```

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