In word I can link a figure using the cross reference menu so when I see the figure's name in the text I just click on it and this takes me in the page with the actual figure.
However, as I'm using rmarkdown to generate the report using bookdown::word_document2
I would like to have these cross links ready made. But when I knit the document the corss references menu is empty. So I have to make it manualy which makes it waste of time using the \@ref
on bookdown.
Is there a way to produce a word file with the cross references already linked?
The code for the word showing in the picture is here,
---
title: Cross-referencing figures, tables, and equations
author: Generated by bookdown
output:
bookdown::word_document2:
toc: yes
toc_depth: 4
fig_caption: yes
number_sections: yes
---
See Figure \@ref(fig:cars-plot).
```{r cars-plot, fig.cap="The cars data.", echo=FALSE}
par(mar = c(4, 4, .2, .1))
plot(cars) # a scatterplot
```
Also see Equation \@ref(eq:mean).
\begin{equation}
\bar{X} = \frac{\sum_{i=1}^n X_i}{n} (\#eq:mean)
\end{equation}
And see Table \@ref(tab:mtcars).
```{r mtcars, echo=FALSE}
knitr::kable(mtcars[1:5, 1:5], caption = "The mtcars data.")
```
Thanks
At the time of writing, pandoc, R Markdown, Bookdown, and Quarto does NOT support Microsoft Word native cross references.