Использование уникальной метки (/ ref {fig: FigName}) для дополнительного материала в Bookdown - PullRequest
0 голосов
/ 28 февраля 2019

Я пишу статью для журнала, который требует дополнительных материалов.Я надеялся использовать уникальную метку, такую ​​как SuppMat: вместо значения по умолчанию fig:, чтобы отправлять рисунки и таблицы в этот раздел.

Мне известны ответы с использованием латекса (найдено здесь , здесь ), но я должен выполнить это при экспорте в docx (да, я знаю, что это ужасно, носоавторы всегда правы *

--- 
title: "My Title"
output:
  bookdown::word_document2:
    fig_caption: yes
link-citations: no
site: bookdown::bookdown_site
---


```{r setup, include=FALSE, cache=FALSE, echo=FALSE}
#create tables
table1 <- mtcars[1,2]
table2 <- mtcars[3,4]

#set knitr options
library(knitr)
knitr::opts_chunk$set(echo = FALSE, 
                      warning = FALSE, 
                      message = FALSE,
                      include = TRUE,
                      dpi = 300)
```

Table \@ref(tab:table1) and Figure \@ref(fig:figure1) ) should be displayed in ***Figure and Tables*** section

I need Supplementary Table \@ref(SuppMat:table2) and a Supplementary Figure \@ref(SuppMat:figure2) to be in Supplementary Material section. Here I try to refer to them using the label ***SuppMat:*** but the numbering is not shown in text.

# Supplementary Material {#SuppMat}
```{r table2}
knitr::kable(table2, caption= "This is the first table in Tables Section it should be in Supplementary Material")
```

```{r figure2, fig.cap="2nd Figure"}
knitr::include_graphics('https://www.rstudio.com/wp-content/uploads/2014/06/RStudio-Ball.png')
```

# Figure and Tables

```{r table1}
knitr::kable(table1, caption= "This is the first table in Tables Section")
```

```{r figure1, fig.cap="1st Figure"}
knitr::include_graphics('https://i.imgur.com/kFlO2Ev.png')
```

Вот как выглядит вывод (ошибки выделены фиолетовым цветом)

...