I am trying to create a figure legend. My figure caption is quite long, so I'm referencing it as part of the text.
Here is the section of the R Markdown:
A reference to the figure in the text (See Figure @ref(fig:fig))
```{r fig, fig.cap="(ref:fig)"}
fig
```
(ref:fig) This legend describes the plot "fig".
When knitted, this should look like the following:
A reference to the figure in the text (See Figure 1)
an image of the figure here
Figure 1: This legend describes the plot "fig".
However, instead I get:
A reference to the figure in the text (See Figure 1)
an image of the figure here
Figure 1: (ref:fig)
(ref:fig) This legend describes the plot "fig".
I'm not sure why it's repeating "(ref:fig)" even though it recognises it as Figure 1. Any help on this would be much appreciated.
question from:
https://stackoverflow.com/questions/65947036/r-markdown-fig-cap-repeats-citation 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…