我正在为一本杂志写一篇需要补充材料的文章。我希望使用一个独特的标签,比如SuppMat:,而不是默认的fig:来向本节发送数字和表。如果没有,我可以使用默认的fig标签,但是我需要在文档的补充材料部分重新编号。
我知道一个使用latex (found here)的答案,但是我必须在导出到docx时完成这一点。下面是一个使用officedown的可重复的示例
---
output:
officedown::rdocx_document
---
```{r setup, include=FALSE}Pacman::p_load(针织品,办公室,军官)
Knitr::opts_chunk$set(回声=假,
eval = TRUE, fig.cap = TRUE)# Main Text
Please see Supplementary Figure \@ref(fig:appendix-fig1) and Figure \@ref(fig:main-fig1).
```{r fig.id="main-fig1", fig.cap="This should be labelled **Figure 1**"}桶形(1:5,col=1:5)
```{r tab.id="main-tab1", tab.cap="Main Text Table 1"}磁头(地铁)
\newpage
# Supplementary Materials {#SuppMat}
```{r fig.id="appendix-fig1", fig.cap="This figure should be labelled **Supplementary Figure 1**"}桶形(1:5,col=1:5)
```{r tab.id="appendix-tab1", tab.cap="Should be labelled **Supplementary Table 1**"}磁头(地铁)
发布于 2021-09-29 19:06:37
在搜索了多个论坛和几个小时之后,我找到了一个使用officedown包的解决方案。希望这能帮到别人。要了解更多细节,请查看run_autonum函数。
---
output: officedown::rdocx_document
---
```{r setup, include=FALSE}Pacman::p_load(办公室、军官、针织品)
knitr::opts_chunk$set(echo = FALSE,fig.cap = TRUE)
ft_base <- fp_text(font.family =“寒武纪”,font.size = 12,粗体=真)
ft1 <- update(ft_base,shading.color='#EFEFEF',color = "red")
ft2 <- update(ft_base,color = "#C32900")
<- file.path( R.home("doc"),"html","logo.jpg“)
extimg <- external_img(src = srcfile,高度= 1.06/5,宽度= 1.39/5)
## References
This is a reference to an supplementary image caption whose number is Supplementary Figure \@ref(fig:faithfuld-plot) and \@ref(fig:supp-bar).
Testing another figure with a barplot in Figure \@ref(fig:plotbar)
```{r fig.id="plotbar", fig.cap = "Main Figure"}桶形(1:8,col=1:2)
## Supplementary Material
```{r fig.id="faithfuld-plot"}Knitr::include_graphics(“映像/MyImage.png”)#在这里使用您自己的图形(我需要用编织器测试我的工作流程)
Block_caption(“第一附录图”,
style = "Figure", autonum = run_autonum(seq_id = 'fig', bkm = 'faithfuld-plot', pre_label = "Supplemental Figure ", start_at=1))```{r fig.id="supp-bar"}桶形(1:8,col=1:2)
Block_caption(“第二附录图”)
style = "Figure", autonum = run_autonum(seq_id = 'fig', bkm = 'supp-bar', pre_label = "Supplemental Figure ", start_at= NULL))https://stackoverflow.com/questions/54915628
复制相似问题