Using Rmarkdown cross-references inside word tables

First off, flextable is dope. It solves so many formatting challenges for me and I love using it.

I have to create word documents because I work with people who must use word for various reasons. flextable has made my life better, thank you.

I was wondering if there is a way to display cross references inside flextable? I don't care about links; I just want the section numbers to show up. For example, if I knit the following I get the desired output using html. However, I could not find a hacky way to get it to work with word (bookdown::word_document2) using flextable or any other method for that matter.

Not looking for a toc solution. How can we use cross-references inside word tables?

---
title: "Can we do this using word_document?"
output: bookdown::html_document2
---

# Section {#ref1}

## Sub section {#ref1-1}

# A different section {#ref2}

```{r echo = FALSE}
suppressMessages(library(tidyverse))
suppressMessages(library(kableExtra))

tibble(
  Section_Name = c("Section",              "Sub section",            "A different section"),
  Section      = c("Section \\@ref(ref1)", "Section \\@ref(ref1-1)", "Section \\@ref(ref2)")
) %>% 
kbl

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.